Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: can't start new thread #483

Open
wasdik opened this issue Dec 13, 2023 · 5 comments
Open

RuntimeError: can't start new thread #483

wasdik opened this issue Dec 13, 2023 · 5 comments

Comments

@wasdik
Copy link

wasdik commented Dec 13, 2023

Just trying to run Odoo 17. But i get an error. What could be the reason?

Logs:

2023-12-13 15:10:40,679 1 INFO ? odoo: Odoo version 17.0-20231208
2023-12-13 15:10:40,679 1 INFO ? odoo: Using configuration file at /etc/odoo/odoo.conf
2023-12-13 15:10:40,679 1 INFO ? odoo: addons paths: ['/usr/lib/python3/dist-packages/odoo/addons', '/var/lib/odoo/addons/17.0', '/mnt/extra-addons']
2023-12-13 15:10:40,680 1 INFO ? odoo: database: odoo@db:5432
2023-12-13 15:10:40,872 1 INFO ? odoo.addons.base.models.ir_actions_report: Will use the Wkhtmltopdf binary at /usr/local/bin/wkhtmltopdf
Traceback (most recent call last):
  File "/usr/bin/odoo", line 8, in <module>
    odoo.cli.main()
  File "/usr/lib/python3/dist-packages/odoo/cli/command.py", line 66, in main
    o.run(args)
  File "/usr/lib/python3/dist-packages/odoo/cli/server.py", line 179, in run
    main(args)
  File "/usr/lib/python3/dist-packages/odoo/cli/server.py", line 172, in main
    rc = odoo.service.server.start(preload=preload, stop=stop)
  File "/usr/lib/python3/dist-packages/odoo/service/server.py", line 1402, in start
    rc = server.run(preload, stop)
  File "/usr/lib/python3/dist-packages/odoo/service/server.py", line 577, in run
    self.start(stop=stop)
  File "/usr/lib/python3/dist-packages/odoo/service/server.py", line 531, in start
    self.http_spawn()
  File "/usr/lib/python3/dist-packages/odoo/service/server.py", line 511, in http_spawn
    t.start()
  File "/usr/lib/python3.10/threading.py", line 935, in start
    _start_new_thread(self._bootstrap, ())
RuntimeError: can't start new thread

docker-compose.yml:

version: '3.1'
services:
  web:
    image: odoo:17.0
    depends_on:
      - db
    ports:
      - "8069:8069"
      - "8072:8072"
    environment:
      - HOST=db
      - USER=odoo
      - PASSWORD=myodoo
  db:
    image: postgres:13
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_USER=odoo
      - POSTGRES_PASSWORD=myodoo
      - PGDATA=/var/lib/postgresql/data/pgdata

@amh-mw
Copy link

amh-mw commented Dec 13, 2023

I just ran docker-compose up with your yaml and it worked fine for me.

2023-12-13 15:44:39,717 1 INFO ? odoo: Odoo version 17.0-20231208 
2023-12-13 15:44:39,717 1 INFO ? odoo: Using configuration file at /etc/odoo/odoo.conf 
2023-12-13 15:44:39,717 1 INFO ? odoo: addons paths: ['/usr/lib/python3/dist-packages/odoo/addons', '/var/lib/odoo/addons/17.0', '/mnt/extra-addons'] 
2023-12-13 15:44:39,717 1 INFO ? odoo: database: odoo@db:5432 
2023-12-13 15:44:40,020 1 INFO ? odoo.addons.base.models.ir_actions_report: Will use the Wkhtmltopdf binary at /usr/local/bin/wkhtmltopdf 
2023-12-13 15:44:40,291 1 INFO ? odoo.service.server: HTTP service (werkzeug) running on 179d8fd85987:8069 

Maybe insufficient resources allocated to Docker? I'm running Docker Desktop on Mac with resource allocation set to 8 vCPU, 20 GB memory and 2 GB swap.

@khirschmann-huebinet
Copy link

I am experiencing the same issue.

@khirschmann-huebinet
Copy link

The problem could be solved by updating the docker version.

@lathama
Copy link

lathama commented Apr 5, 2024

@khirschmann-huebinet Can you close this issue if you have a resolution?

@sra-rdflex
Copy link

Resolving Odoo 17 Thread Error in Docker
I encountered a RuntimeError: can't start new thread error while running Odoo 17 in a Docker container. After some troubleshooting, I found that the container needed additional privileges to access host machine resources. Here’s how I resolved the issue:

Use the --privileged Flag: Running the Docker container with the --privileged flag allows the container to access host resources directly, which can help resolve threading issues. You can modify your docker-compose.yml to include this flag :

services:
  web:
    ...
    privileged: true

It will work me
Note :

  1. Use the --privileged flag only when absolutely necessary.
  2. Consider using more granular capabilities with the --cap-add and --cap-drop options to limit the privileges instead of enabling all.
  3. Regularly review and audit containers running with elevated privileges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants