Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Deque mutated during iteration #24550

Merged
merged 2 commits into from
Jun 29, 2023

Conversation

michael-s-molina
Copy link
Member

@michael-s-molina michael-s-molina commented Jun 29, 2023

SUMMARY

Fix a bug introduced by #24488 that happens when running on SQL Lite. There was an event being registered inside another event and causing a deque mutated during iteration error. According to SQL Alchemy docs:

The listen() function cannot be called at the same time that the target event is being run. This has implications for thread safety, and also means an event cannot be added from inside the listener function for itself. The list of events to be run are present inside of a mutable collection that can’t be changed during iteration.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Screenshot 2023-06-29 at 09 35 53

TESTING INSTRUCTIONS

  • Check that the above error does not happen when accessing a dashboard on SQL Lite.
  • Check that if a dataset is deleted, its associated columns and metrics are also deleted.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@michael-s-molina michael-s-molina changed the title fix: Deque muteted during iteration fix: Deque mutated during iteration Jun 29, 2023
@codecov
Copy link

codecov bot commented Jun 29, 2023

Codecov Report

Merging #24550 (d5114b4) into master (66f59e5) will increase coverage by 0.07%.
The diff coverage is 100.00%.

❗ Current head d5114b4 differs from pull request most recent head c641a73. Consider uploading reports for the commit c641a73 to get more accurate results

@@            Coverage Diff             @@
##           master   #24550      +/-   ##
==========================================
+ Coverage   68.98%   69.05%   +0.07%     
==========================================
  Files        1906     1906              
  Lines       74114    74114              
  Branches     8155     8155              
==========================================
+ Hits        51124    51182      +58     
+ Misses      20871    20813      -58     
  Partials     2119     2119              
Flag Coverage Δ
hive 53.92% <20.00%> (?)
mysql 79.40% <20.00%> (?)
postgres 79.49% <20.00%> (ø)
presto 53.82% <20.00%> (ø)
python 83.43% <100.00%> (+0.16%) ⬆️
sqlite ?
unit 54.69% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset/utils/core.py 91.59% <100.00%> (+0.11%) ⬆️

... and 11 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -35,7 +35,7 @@ def test_create_ssh_tunnel():
"password": "bar",
}

result = SSHTunnelDAO.create(properties)
result = SSHTunnelDAO.create(properties, commit=False)
Copy link
Member Author

Choose a reason for hiding this comment

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

@hughhhh I set commit=False to mimic the other tests in the ssh_tunnel/commands folder which use CreateSSHTunnelCommand that has commit=False by default. If we enable the commit in this test or in the command ones, they will fail because there's no database with id = 1. If an actual commit is required for the tests, I suggest opening a follow-up PR and fixing not only this test but the ones in the commands folder.

@michael-s-molina michael-s-molina merged commit bb1db9e into apache:master Jun 29, 2023
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.0.0 labels Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/M 🚢 3.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants