Skip to content

Sqa panel code break for multiple threads #345

@mei-li

Description

@mei-li

Sqa.py code is adding to the DB connection the attribute pdtb_start_timer here

Then it removes this attribute. When accessing the DB with multiple threads this code breaks if both threads are executing and then the first that reaches the after will remove it and the second will fail.

 in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/home/meili/.pyenv/versions/3.6.4/envs/radar364/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1010, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/home/meili/.pyenv/versions/3.6.4/envs/radar364/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1153, in _execute_context
    context.executemany)
  File "/home/meili/.pyenv/versions/3.6.4/envs/radar364/lib/python3.6/site-packages/sqlalchemy/event/attr.py", line 256, in __call__
    fn(*args, **kw)
  File "/home/meili/.pyenv/versions/3.6.4/envs/radar364/lib/python3.6/site-packages/pyramid_debugtoolbar/panels/sqla.py", line 44, in _after_cursor_execute
    delattr(conn, 'pdtb_start_timer')

Using latest version, 4.5

Unfortunately this code will still be executed, even is this panel is not configured. I tried to fix this issue without any luck so far.
Maybe one way to start is to isolate this code so it can actually be switched off.

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