zodb / relstorage

A backend for ZODB that stores pickles in a relational database.
Other
53 stars 46 forks source link

psycopg2.ProgrammingError: named cursor isn't valid anymore #486

Closed abl123 closed 1 year ago

abl123 commented 2 years ago

Trying to run zodbupdate to convert a database from python 2.7 to python 3 on Plone 5.2. I'm running bin/zodbupdate --pack --convert-py3 --encoding utf8 --encoding-fallback latin1 -c migration.conf.

Committing changes (#1).
Using store connection <StoreConnection at 0x7f70ae438f90 active=False description={'backend_pid': xxx} conn=<connection object at 0x7f70ae4b4440; dsn: '[...]', closed: 0> cur=<cursor object at 0x7f70ae422650; closed: 0>>
Function _flush_temps_to_db took 1.660s.
Function _lock_and_move took 3.991s.
Objects were locked by tpc_finish for 3.992s
Function tpc_finish took 4.475s.
Exception closing <cursor object at 0x7f70b38d5450; closed: 0>
Traceback (most recent call last):
  File "/srv/plone/cache/eggs/RelStorage-3.4.5-py3.7-linux-x86_64.egg/relstorage/adapters/connections.py", line 279, in server_side_cursor
    yield ss_cursor
  File "/srv/plone/cache/eggs/RelStorage-3.4.5-py3.7-linux-x86_64.egg/relstorage/storage/__init__.py", line 586, in __record_iternext_gen
    for record in self._adapter.dbiter.iter_current_records(ss_cursor, start_oid_int):
  File "/srv/plone/cache/eggs/RelStorage-3.4.5-py3.7-linux-x86_64.egg/relstorage/adapters/dbiter.py", line 96, in iter_current_records
    for oid_int, tid_int, state_bytes in cursor:
psycopg2.ProgrammingError: named cursor isn't valid anymore

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/plone/cache/eggs/RelStorage-3.4.5-py3.7-linux-x86_64.egg/relstorage/adapters/connmanager.py", line 186, in close
    obj.close()
psycopg2.ProgrammingError: named cursor isn't valid anymore
An error occured
Traceback (most recent call last):
  File "/srv/plone/cache/eggs/zodbupdate-1.5-py3.7.egg/zodbupdate/main.py", line 223, in main
    updater()
  File "/srv/plone/cache/eggs/zodbupdate-1.5-py3.7.egg/zodbupdate/update.py", line 81, in __call__
    for oid, serial, current in self.records:
  File "/srv/plone/cache/eggs/zodbupdate-1.5-py3.7.egg/zodbupdate/update.py", line 147, in records
    oid, tid, data, next = storage.record_iternext(next)
  File "/srv/plone/cache/eggs/RelStorage-3.4.5-py3.7-linux-x86_64.egg/relstorage/storage/__init__.py", line 643, in record_iternext
    new_oid, new_tid, new_state = self.__next(cursor)
  File "/srv/plone/cache/eggs/RelStorage-3.4.5-py3.7-linux-x86_64.egg/relstorage/storage/__init__.py", line 586, in __record_iternext_gen
    for record in self._adapter.dbiter.iter_current_records(ss_cursor, start_oid_int):
  File "/srv/plone/cache/eggs/RelStorage-3.4.5-py3.7-linux-x86_64.egg/relstorage/adapters/dbiter.py", line 96, in iter_current_records
    for oid_int, tid_int, state_bytes in cursor:
psycopg2.ProgrammingError: named cursor isn't valid anymore
Stopped processing, due to: named cursor isn't valid anymore
Traceback (most recent call last):
  File "/srv/plone/cache/eggs/zodbupdate-1.5-py3.7.egg/zodbupdate/main.py", line 223, in main
    updater()
  File "/srv/plone/cache/eggs/zodbupdate-1.5-py3.7.egg/zodbupdate/update.py", line 81, in __call__
    for oid, serial, current in self.records:
  File "/srv/plone/cache/eggs/zodbupdate-1.5-py3.7.egg/zodbupdate/update.py", line 147, in records
    oid, tid, data, next = storage.record_iternext(next)
  File "/srv/plone/cache/eggs/RelStorage-3.4.5-py3.7-linux-x86_64.egg/relstorage/storage/__init__.py", line 643, in record_iternext
    new_oid, new_tid, new_state = self.__next(cursor)
  File "/srv/plone/cache/eggs/RelStorage-3.4.5-py3.7-linux-x86_64.egg/relstorage/storage/__init__.py", line 586, in __record_iternext_gen
    for record in self._adapter.dbiter.iter_current_records(ss_cursor, start_oid_int):
  File "/srv/plone/cache/eggs/RelStorage-3.4.5-py3.7-linux-x86_64.egg/relstorage/adapters/dbiter.py", line 96, in iter_current_records
    for oid_int, tid_int, state_bytes in cursor:
psycopg2.ProgrammingError: named cursor isn't valid anymore

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/plone/bin/zodbupdate", line 294, in <module>
    sys.exit(zodbupdate.main.main())
  File "/srv/plone/cache/eggs/zodbupdate-1.5-py3.7.egg/zodbupdate/main.py", line 227, in main
    raise AssertionError()
AssertionError

Versions:

PostgreSQL 11.12
psycopg2 = 2.9.2
relstorage = 3.4.5

I've tried multiple version of psycopg2, and get the same error.

jamadden commented 1 year ago

No updates since 2021 and things have moved on quite a bit since then; closing.