Skip to content

Conversation

apmorton
Copy link
Contributor

@apmorton apmorton commented Feb 2, 2024

In an application that is executing sqlalchemy cursors on a thread concurrently with another thread calling sentry_sdk.init it is possible for _after_cursor_execute to be called on a cursor that never had _before_cursor_execute called.

  File "site-packages/sentry_sdk/integrations/sqlalchemy.py", line 98, in _after_cursor_execute
    span = context._sentry_sql_span
           ^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'PGExecutionContext_psycopg2' object has no attribute '_sentry_sql_span'

@sentrivana sentrivana added the Trigger: tests using secrets PR code is safe; run CI label Feb 5, 2024
Copy link
Contributor

@sentrivana sentrivana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you @apmorton!

@sentrivana sentrivana enabled auto-merge (squash) February 5, 2024 14:51
@sentrivana sentrivana merged commit 4afb955 into getsentry:master Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Trigger: tests using secrets PR code is safe; run CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants