zatosource / zato

ESB, SOA, REST, APIs and Cloud Integrations in Python
https://zato.io
GNU Affero General Public License v3.0
1.12k stars 240 forks source link

odoo outgoing conn Exception: No free connections to `connector` #1047

Closed aixi88 closed 4 years ago

aixi88 commented 4 years ago

How to close odoo outgoing connection? thanks!


        with self.outgoing.odoo.get('connector').conn.client() as client:
            service = client.get_service("object")
            client.check_login()
            job = service.execute(client.database, client.user_id, client.password, "connector.job",
                                  "search_read", [("id", "=", job_id),('state','=','pending')], [], 0, 1)

2020-05-05 06:00:00,364 - ^[[1;31mERROR^[[0m - 442:DummyThread-310 - zato.server.connection.queue:0 - No free connections to connector 2020-05-05 06:00:00,364 - ^[[1;33mWARNING^[[0m - 442:DummyThread-310 - zato.server.service:0 - Traceback (most recent call last): File "/opt/zato/3.1.0/code/zato-server/src/zato/server/connection/queue.py", line 46, in enter self.client = self.queue.get(self.should_block, self.block_timeout) File "src/gevent/queue.py", line 329, in gevent._queue.Queue.get File "src/gevent/queue.py", line 344, in gevent._queue.Queue.get File "src/gevent/queue.py", line 313, in gevent._queue.Queue.__get_or_peek queue.Empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/opt/zato/3.1.0/code/zato-server/src/zato/server/service/init.py", line 660, in update_handle self._invoke(service, channel) File "/opt/zato/3.1.0/code/zato-server/src/zato/server/service/init.py", line 547, in _invoke service.handle() File "/opt/zato/env/qs-1/work/hot-deploy/current/kd_connector.py", line 118, in handle with self.outgoing.odoo.get('connector').conn.client() as client: File "/opt/zato/3.1.0/code/zato-server/src/zato/server/connection/queue.py", line 51, in enter raise Exception(msg) Exception: No free connections to connector

dsuch commented 4 years ago

You do not do it explicitly - when you are done with a given connection, it will be returned to the pool automatically.

Thus, if you are seeing this exception it means that either your Odoo queries take too long or that you need to increase your pool size.

Also, please start to format tracebacks correctly. You have been opening tickets for a longer time and it really is difficult to read them without code formatting.

aixi88 commented 4 years ago

thank you! I'll pay attention to code formatting。