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

OperationalError: Unable to use a closed cursor #578

Open
m3asmi opened this issue Nov 20, 2023 · 3 comments
Open

OperationalError: Unable to use a closed cursor #578

m3asmi opened this issue Nov 20, 2023 · 3 comments
Labels

Comments

@m3asmi
Copy link

m3asmi commented Nov 20, 2023

I have this everytime, the server is runing on multi jobs

2023-11-20 11:51:56,807 2315175 INFO Database werkzeug: 127.0.0.1 - - [20/Nov/2023 11:51:56] "GET /queue_job/runjob?db=tecnibo&job_uuid=592f8f47-3fbd-4811-899d-ee2f22b8fa74 HTTP/1.1" 500 - 43 0.033 0.877
2023-11-20 11:51:56,808 2315183 ERROR ? odoo.addons.queue_job.jobrunner.runner: exception in GET http://localhost:8869/queue_job/runjob?db=tecnibo&job_uuid=592f8f47-3fbd-4811-899d-ee2f22b8fa74 
Traceback (most recent call last):
  File "/odoo/custom/others/queue_job/jobrunner/runner.py", line 242, in urlopen
    response.raise_for_status()
  File "/usr/local/lib/python3.8/dist-packages/requests/models.py", line 943, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: INTERNAL SERVER ERROR for url: http://localhost:8869/queue_job/runjob?db=tecnibo&job_uuid=592f8f47-3fbd-4811-899d-ee2f22b8fa74
2023-11-20 11:51:56,810 2315175 ERROR tecnibo werkzeug: Error on request:
Traceback (most recent call last):
  File "/odoo/odoo-server/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
    result = request.dispatch()
  File "/odoo/odoo-server/odoo/http.py", line 815, in dispatch
    r = self._call_function(**self.params)
  File "/odoo/odoo-server/odoo/http.py", line 368, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/odoo/odoo-server/odoo/service/model.py", line 94, in wrapper
    return f(dbname, *args, **kwargs)
  File "/odoo/odoo-server/odoo/http.py", line 357, in checked_call
    result = self.endpoint(*a, **kw)
  File "/odoo/odoo-server/odoo/http.py", line 921, in __call__
    return self.method(*args, **kw)
  File "/odoo/odoo-server/odoo/http.py", line 546, in response_wrap
    response = f(*args, **kw)
  File "/odoo/custom/others/queue_job/controllers/main.py", line 149, in runjob
    self._enqueue_dependent_jobs(env, job)
  File "/odoo/custom/others/queue_job/controllers/main.py", line 47, in _enqueue_dependent_jobs
    job.enqueue_waiting()
  File "/odoo/custom/others/queue_job/job.py", line 566, in enqueue_waiting
    self.env.cr.execute(sql, (PENDING, self.uuid, DONE, WAIT_DEPENDENCIES))
  File "<decorator-gen-3>", line 2, in execute
    
  File "/odoo/odoo-server/odoo/sql_db.py", line 89, in check
    raise psycopg2.OperationalError('Unable to use a closed cursor.')
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/werkzeug/serving.py", line 306, in run_wsgi
    execute(self.server.app)
  File "/usr/local/lib/python3.8/dist-packages/werkzeug/serving.py", line 294, in execute
    application_iter = app(environ, start_response)
  File "/odoo/odoo-server/odoo/service/wsgi_server.py", line 112, in application
    return application_unproxied(environ, start_response)
  File "/odoo/odoo-server/odoo/service/wsgi_server.py", line 87, in application_unproxied
    result = odoo.http.root(environ, start_response)
  File "/odoo/odoo-server/odoo/http.py", line 1305, in __call__
    return self.dispatch(environ, start_response)
  File "/odoo/odoo-server/odoo/http.py", line 1271, in __call__
    return self.app(environ, start_wrapped)
  File "/usr/local/lib/python3.8/dist-packages/werkzeug/middleware/shared_data.py", line 220, in __call__
    return self.app(environ, start_response)
  File "/odoo/odoo-server/odoo/http.py", line 1500, in dispatch
    result = ir_http._dispatch()
  File "/odoo/odoo-server/addons/website_sale/models/ir_http.py", line 15, in _dispatch
    return super(IrHttp, cls)._dispatch()
  File "/odoo/odoo-server/addons/website/models/ir_http.py", line 198, in _dispatch
    response = super(Http, cls)._dispatch()
  File "/odoo/odoo-server/addons/auth_signup/models/ir_http.py", line 19, in _dispatch
    return super(Http, cls)._dispatch()
  File "/odoo/odoo-server/addons/web_editor/models/ir_http.py", line 21, in _dispatch
    return super(IrHttp, cls)._dispatch()
  File "/odoo/odoo-server/addons/utm/models/ir_http.py", line 29, in _dispatch
    response = super(IrHttp, cls)._dispatch()
  File "/odoo/odoo-server/addons/http_routing/models/ir_http.py", line 519, in _dispatch
    result = super(IrHttp, cls)._dispatch()
  File "/odoo/odoo-server/odoo/addons/base/models/ir_http.py", line 241, in _dispatch
    return cls._handle_exception(e)
  File "/odoo/odoo-server/addons/utm/models/ir_http.py", line 34, in _handle_exception
    response = super(IrHttp, cls)._handle_exception(exc)
  File "/odoo/odoo-server/addons/http_routing/models/ir_http.py", line 620, in _handle_exception
    return super(IrHttp, cls)._handle_exception(exception)
  File "/odoo/odoo-server/odoo/addons/base/models/ir_http.py", line 209, in _handle_exception
    return request._handle_exception(exception)
  File "/odoo/odoo-server/odoo/http.py", line 759, in _handle_exception
    return super(HttpRequest, self)._handle_exception(exception)
  File "/odoo/odoo-server/odoo/http.py", line 301, in _handle_exception
    raise exception.with_traceback(None) from new_cause
psycopg2.OperationalError: Unable to use a closed cursor. - - -
@m3asmi m3asmi added the bug label Nov 20, 2023
Copy link

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label May 19, 2024
@simahawk
Copy link
Contributor

@m3asmi do you still have this issue?

@github-actions github-actions bot removed the stale PR/Issue without recent activity, it'll be soon closed automatically. label May 26, 2024
@m3asmi
Copy link
Author

m3asmi commented Oct 4, 2024

@simahawk yes I still have it, here is of today:

2024-10-04 07:35:35,063 809805 INFO DATABASE werkzeug: 127.0.0.1 - - [04/Oct/2024 07:35:35] "GET /queue_job/runjob?db=DATABASE&job_uuid=5c7b1d30-6819-4ff7-b230-96abddafe4ed HTTP/1.1" 500 - 36 1.608 2.884
2024-10-04 07:35:35,066 809805 ERROR DATABASE werkzeug: Error on request:
Traceback (most recent call last):
  File "/odoo/odoo-server/odoo/addons/base/models/ir_http.py", line 242, in _dispatch
    result = request.dispatch()
  File "/odoo/odoo-server/odoo/http.py", line 819, in dispatch
    r = self._call_function(**self.params)
  File "/odoo/odoo-server/odoo/http.py", line 368, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/odoo/odoo-server/odoo/service/model.py", line 94, in wrapper
    return f(dbname, *args, **kwargs)
  File "/odoo/odoo-server/odoo/http.py", line 357, in checked_call
    result = self.endpoint(*a, **kw)
  File "/odoo/odoo-server/odoo/http.py", line 925, in __call__
    return self.method(*args, **kw)
  File "/odoo/odoo-server/odoo/http.py", line 546, in response_wrap
    response = f(*args, **kw)
  File "/odoo/custom/others/queue_job/controllers/main.py", line 149, in runjob
    self._enqueue_dependent_jobs(env, job)
  File "/odoo/custom/others/queue_job/controllers/main.py", line 47, in _enqueue_dependent_jobs
    job.enqueue_waiting()
  File "/odoo/custom/others/queue_job/job.py", line 566, in enqueue_waiting
    self.env.cr.execute(sql, (PENDING, self.uuid, DONE, WAIT_DEPENDENCIES))
  File "<decorator-gen-5>", line 2, in execute
    
  File "/odoo/odoo-server/odoo/sql_db.py", line 89, in check
    raise psycopg2.OperationalError('Unable to use a closed cursor.')
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/werkzeug/serving.py", line 319, in run_wsgi
    execute(self.server.app)
  File "/usr/local/lib/python3.8/dist-packages/werkzeug/serving.py", line 308, in execute
    application_iter = app(environ, start_response)
  File "/odoo/odoo-server/odoo/service/wsgi_server.py", line 112, in application
    return application_unproxied(environ, start_response)
  File "/odoo/odoo-server/odoo/service/wsgi_server.py", line 87, in application_unproxied
    result = odoo.http.root(environ, start_response)
  File "/odoo/odoo-server/odoo/http.py", line 1355, in __call__
    return self.dispatch(environ, start_response)
  File "/odoo/odoo-server/odoo/http.py", line 1321, in __call__
    return self.app(environ, start_wrapped)
  File "/usr/local/lib/python3.8/dist-packages/werkzeug/middleware/shared_data.py", line 287, in __call__
    return self.app(environ, start_response)
  File "/odoo/odoo-server/odoo/http.py", line 1548, in dispatch
    result = ir_http._dispatch()
  File "/odoo/odoo-server/addons/website_sale/models/ir_http.py", line 15, in _dispatch
    return super(IrHttp, cls)._dispatch()
  File "/odoo/odoo-server/addons/website/models/ir_http.py", line 199, in _dispatch
    response = super(Http, cls)._dispatch()
  File "/odoo/odoo-server/addons/auth_signup/models/ir_http.py", line 19, in _dispatch
    return super(Http, cls)._dispatch()
  File "/odoo/odoo-server/addons/web_editor/models/ir_http.py", line 21, in _dispatch
    return super(IrHttp, cls)._dispatch()
  File "/odoo/odoo-server/addons/utm/models/ir_http.py", line 29, in _dispatch
    response = super(IrHttp, cls)._dispatch()
  File "/odoo/odoo-server/addons/http_routing/models/ir_http.py", line 519, in _dispatch
    result = super(IrHttp, cls)._dispatch()
  File "/odoo/odoo-server/odoo/addons/base/models/ir_http.py", line 246, in _dispatch
    return cls._handle_exception(e)
  File "/odoo/odoo-server/addons/utm/models/ir_http.py", line 34, in _handle_exception
    response = super(IrHttp, cls)._handle_exception(exc)
  File "/odoo/odoo-server/addons/http_routing/models/ir_http.py", line 616, in _handle_exception
    return super(IrHttp, cls)._handle_exception(exception)
  File "/odoo/odoo-server/odoo/addons/base/models/ir_http.py", line 214, in _handle_exception
    return request._handle_exception(exception)
  File "/odoo/odoo-server/odoo/http.py", line 763, in _handle_exception
    return super(HttpRequest, self)._handle_exception(exception)
  File "/odoo/odoo-server/odoo/http.py", line 301, in _handle_exception
    raise exception.with_traceback(None) from new_cause
psycopg2.OperationalError: Unable to use a closed cursor. - - -
2024-10-04 07:35:40,052 809810 DEBUG ? odoo.addons.queue_job.jobrunner.channels: job 5c7b1d30-6819-4ff7-b230-96abddafe4ed marked running in channel root(C:18,Q:0,R:1,F:4) 

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

No branches or pull requests

2 participants