OCA / queue

Asynchronous Job Queue
GNU Affero General Public License v3.0
183 stars 460 forks source link

[FIX] queue_job: runner - filedescriptor out of range in select #551

Closed gurneyalex closed 1 year ago

gurneyalex commented 1 year ago

This is a forward port of #408

Use the most efficient Selector implementation available on the current platform

Odoo supports only SelectSelector but it is a little obsolete

python >= 3.4 supports a new high-level library Selectors:

It could to auto-choose the following ones:

Using the DefaultSelector class the most efficient implementation available on the current platform will be use:

It helps to support better the resources of the system

Using SelectSelector you are not able to run workers >=255

If you set ulimit -n 10240 and run odoo-bin --workers=255 the following error is raised:

Traceback (most recent call last):
File "odoo/service/server.py", line 926, in run
    self.sleep()
File "odoo/service/server.py", line 852, in sleep
    sel.select(self.beat)
File "python3.8/lib/python3.8/selectors.py", line 323, in select
    r, w, _ = self._select(self._readers, self._writers, [], timeout)
ValueError: filedescriptor out of range in select()

But using PollSelector it is not reproduced even using more workers

Most of platform supports PollSelector but using DefaultSelector we can be sure that even too old system are supported too

And using this High-level library will allow to use the future new improvements

e.g. Epoll has better performance improvements

More info about:

OCA-git-bot commented 1 year ago

Hi @guewen, some modules you are maintaining are being modified, check this out!

guewen commented 1 year ago

/ocabot merge minor

OCA-git-bot commented 1 year ago

Hey, thanks for contributing! Proceeding to merge this for you. Prepared branch 15.0-ocabot-merge-pr-551-by-guewen-bump-minor, awaiting test results.

OCA-git-bot commented 1 year ago

Congratulations, your PR was merged at ee9ab4e907fece1ea9fee3291f79137f042deb84. Thanks a lot for contributing to OCA. ❤️