Skip to content

Concurrency issues with multiple simultaneous writes #302

Description

@d-auclair

There were numerous race conditions and thread safety issues for multiple simultaneous writes.

This resulted in errors such as:

  ERR event=Exception on /taxii2/6806f1b8-2bb1-45e1-a91e-da44b8aa9a5c/collections/e880fc06-f31e-4d74-
  8e66-f66280ef8dff/objects/ [POST] exc_info=["<class 'sqlalchemy.exc.ResourceClosedError'>","ResourceClosedError('This
  result object does not return rows. It has been closed automatically.')","<traceback object at 0x7fcfbcf34400>"]
  logger=opentaxii.middleware timestamp=2026-07-22T17:44:21.205731Z

  ERR event=Exception on /taxii2/6806f1b8-2bb1-45e1-a91e-da44b8aa9a5c/collections/e880fc06-f31e-4d74-8e66-f66280ef8dff/
  objects/ [POST] exc_info=["<class 'sqlalchemy.exc.DatabaseError'>","DatabaseError('(psycopg2.DatabaseError) error with
  status PGRES_TUPLES_OK and no message from the libpq')","<traceback object at 0x7fcfbc39f640>"]
  logger=opentaxii.middleware timestamp=2026-07-22T17:44:21.205880Z

Also the write performance was severely limited by the 1 update per record approach.
Lastly, the connection pool tended to exhaust the available connections due to not consistently releasing the connections once no longer needed.

If you're willing to review some AI generated updates, I've got a PR ready to roll.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions