dcb56412d667231c5427b0cd76cfc1c6c4b1dd3c
The multi-threaded server graceful stop policy is now as follows: - shutdown the server so it does not accept new requests (the socket remains open), - wait for remaining requests to finish up to a certain time (e.g. 1 second) Previously, the multi-threaded server waited indefinitely for requests to finish. The reload policy when a thread reaches a limit is as following: - wait there is no other running requests, up to 1 minute - then stop the server (with the above graceful stop policy applied), - then reload the server, therefore accepting new requests again. - The socket is not closed during this operation. This allows the inverse proxy to queue the requests arriving during the time the server is shutted down and therefore not accepting new requests. This allows a transparent restart for the users, as their requests done during the shutting down of the server are not rejected but queued. - When a thread reaches a limit, we reload the whole threaded server instead of just killing this thread. Killing a thread is not a good practice as it could lead to dead locks in case these threads acquire locks. Killing a thread that acquired a lock would lead for this lock to never be released. Regarding the override of `_handle_request_noblock`: In `socketserver`, when `shutdown` is called `__shutdown_request` is set to True, https://github.com/python/cpython/blob/6a7b3a77b4b2be0badd24ee5f0fdbaa2e0e79c3d/Lib/socketserver.py#L241-L249 This tells the server to no longer accept requests. Callstack below: - https://github.com/python/cpython/blob/6a7b3a77b4b2be0badd24ee5f0fdbaa2e0e79c3d/Lib/socketserver.py#L231-L234 - https://github.com/python/cpython/blob/6a7b3a77b4b2be0badd24ee5f0fdbaa2e0e79c3d/Lib/socketserver.py#L308 - https://github.com/python/cpython/blob/6a7b3a77b4b2be0badd24ee5f0fdbaa2e0e79c3d/Lib/socketserver.py#L487 Unfortunately, this is very possible the HTTP server is already polling for a request when this flag is set to `True` by the main thread: - https://github.com/python/cpython/blob/6a7b3a77b4b2be0badd24ee5f0fdbaa2e0e79c3d/Lib/socketserver.py#L232 As the poll_interval is set to 0.5s: - https://github.com/python/cpython/blob/6a7b3a77b4b2be0badd24ee5f0fdbaa2e0e79c3d/Lib/socketserver.py#L215 if a request arrives within 500ms after the server is shut down, the request is accepted, while the server is shutdown. We want to prevent this: Once the server is marked as shut down, we want it to no longer accept requests: so the inverse proxy knows it has to queue the request. closes odoo/odoo#24982
Odoo
Odoo is a suite of web based open source business apps.
The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, Purchase Management, ...
Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.
Getting started with Odoo
For a standard installation please follow the Setup instructions from the documentation.
Then follow the developer tutorials
Languages
Python
49.6%
JavaScript
47.8%
SCSS
2%
CSS
0.3%
HTML
0.2%