Uploaded image for project: 'Instrument control development'
  1. Instrument control development
  2. INSTRM-2341

Correctly wrap opdb transactions

    XMLWordPrintable

    Details

      Description

      Looks like some opdb transaction is not being rolled back after a failure. One exposure failed with:

      2024-08-19 06:42:20.597Z cmds             20 CommandLink.py:122 > 2 568 f text="command failed: OperationalError('(psycopg2.OperationalError) terminating connection due to administrator command\\nserver closed the connection unexpectedly\\n\\tT
      his probably means the server terminated abnormally\\n\\tbefore or while processing the request.\\n') in do_execute() at /software/conda/envs/rubin3_ics/lib/python3.8/site-packages/sqlalchemy/engine/default.py:732"
      

      which is OK, or at least not mcsActor's problem. But the next exposure failed with:

      2024-08-19T06:53:31.634 mcs i text="frame=11334200 visit=113342 az=90.0257 alt=89.9414 instrot=0.0"
      2024-08-19T06:53:31.635 mcs f text="command failed: PendingRollbackError(\"Can't reconnect until invalid transaction is rolled back.\") in _invalid_transaction() at /software/conda/envs/rubin3_ics/lib/python3.8/site-packages/sqlalchemy/engine/base.py:543"
      

      which is not OK.

      Note that the way to phrase this correctly will be different in psycopg3, which is the preferred library under python 3.11. Basically, both versions strongly favor using context managers, but psycopg3 is clearer about distinguishing connections, cursors, transactions.

        Attachments

          Activity

            People

            • Assignee:
              karr karr
              Reporter:
              cloomis cloomis
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: