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

cherrypy server doesn't recover from psycopg2.error - Idle InTransaction Session Timeout #928

Open
hppritcha opened this issue Nov 12, 2021 · 1 comment

Comments

@hppritcha
Copy link
Member

Occassionally one of the cherrypy SQL query operations times out with this kind of traceback:

[17/Aug/2021:03:21:05] HTTP
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cherrypy/_cprequest.py", line 670, in respond
    response.body = self.handler()
  File "/usr/lib/python3/dist-packages/cherrypy/lib/encoding.py", line 220, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/cherrypy/lib/jsontools.py", line 61, in json_handler
    value = cherrypy.serving.request._json_inner_handler(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/cherrypy/_cpdispatch.py", line 60, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/mnt/data/mtt.open-mpi.org/mtt/server/php/cherrypy/src/webapp/dispatchers.py", line 337, in POST
    submit_info = self._db.get_submit_id(data['metadata'])
  File "/mnt/data/mtt.open-mpi.org/mtt/server/php/cherrypy/src/webapp/db_pgv3.py", line 664, in get_submit_id
    submit_id = self._select_insert("submit", "submit_id", fields, values)
  File "/mnt/data/mtt.open-mpi.org/mtt/server/php/cherrypy/src/webapp/db_pgv3.py", line 565, in _select_insert
    cursor.execute("SELECT * FROM %s LIMIT 0" % table)
psycopg2.errors.IdleInTransactionSessionTimeout: terminating connection due to idle-in-transaction timeout
SSL connection has been closed unexpectedly

The way its currently implemented, the cherrypy server never tries to reconnect to the SQL database, so subsequent operations always fail with this kind of error message:


[17/Aug/2021:05:13:39] HTTP
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cherrypy/_cprequest.py", line 670, in respond
    response.body = self.handler()
  File "/usr/lib/python3/dist-packages/cherrypy/lib/encoding.py", line 220, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/cherrypy/lib/jsontools.py", line 61, in json_handler
    value = cherrypy.serving.request._json_inner_handler(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/cherrypy/_cpdispatch.py", line 60, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/mnt/data/mtt.open-mpi.org/mtt/server/php/cherrypy/src/webapp/dispatchers.py", line 337, in POST
    submit_info = self._db.get_submit_id(data['metadata'])
  File "/mnt/data/mtt.open-mpi.org/mtt/server/php/cherrypy/src/webapp/db_pgv3.py", line 664, in get_submit_id
    submit_id = self._select_insert("submit", "submit_id", fields, values)
  File "/mnt/data/mtt.open-mpi.org/mtt/server/php/cherrypy/src/webapp/db_pgv3.py", line 563, in _select_insert
    cursor = self.get_cursor()
  File "/mnt/data/mtt.open-mpi.org/mtt/server/php/cherrypy/src/webapp/db_pgv3.py", line 305, in get_cursor
    return self._connection.cursor()
psycopg2.InterfaceError: connection already closed

The only way currently to fix this is to restart the cherrypy server.

@hppritcha
Copy link
Member Author

@jjhursey this is the MTT cherrypy server error I brought up a couple of OMPI devel calls ago.

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

1 participant