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(init): Initialize _jwt_cookie_name in AsyncQueryManager __init__ #22314

Merged
merged 1 commit into from
Dec 22, 2022

Conversation

xneg
Copy link
Contributor

@xneg xneg commented Dec 2, 2022

SUMMARY

We face an issue. After setting GLOBAL_ASYNC_QUERIES to True and switching back again to False we gain errors 'AsyncQueryManager' object has no attribute '_jwt_cookie_name'.
Stacktrace of this error:

File "/usr/local/lib/python3.7/site-packages/flask_appbuilder/api/__init__.py", line 85, in wraps
    return f(self, *args, **kwargs)
  File "/app/superset/async_events/api.py", line 92, in events
    async_channel_id = async_query_manager.parse_jwt_from_request(request)[
  File "/app/superset/utils/async_query_manager.py", line 162, in parse_jwt_from_request
    token = req.cookies.get(self._jwt_cookie_name)
AttributeError: 'AsyncQueryManager' object has no attribute '_jwt_cookie_name'

Initializing this field inside __init__ fixes this issue.

@codecov
Copy link

codecov bot commented Dec 2, 2022

Codecov Report

Merging #22314 (b900a06) into master (aa97ba4) will decrease coverage by 0.16%.
The diff coverage is 100.00%.

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

@@            Coverage Diff             @@
##           master   #22314      +/-   ##
==========================================
- Coverage   65.59%   65.43%   -0.17%     
==========================================
  Files        1847     1847              
  Lines       70333    70333              
  Branches     7702     7702              
==========================================
- Hits        46138    46020     -118     
- Misses      22197    22315     +118     
  Partials     1998     1998              
Flag Coverage Δ
hive ?
mysql 78.04% <100.00%> (ø)
postgres 78.11% <100.00%> (ø)
presto ?
python 78.23% <100.00%> (-0.36%) ⬇️
sqlite 76.57% <100.00%> (ø)

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

Impacted Files Coverage Δ
superset/utils/async_query_manager.py 80.41% <100.00%> (ø)
superset/db_engines/hive.py 0.00% <0.00%> (-85.19%) ⬇️
superset/db_engine_specs/hive.py 71.14% <0.00%> (-16.21%) ⬇️
superset/db_engine_specs/presto.py 80.16% <0.00%> (-7.65%) ⬇️
superset/models/sql_lab.py 72.83% <0.00%> (-1.97%) ⬇️
superset/connectors/sqla/models.py 88.52% <0.00%> (-0.80%) ⬇️
superset/db_engine_specs/base.py 81.25% <0.00%> (-0.32%) ⬇️
superset/models/core.py 90.27% <0.00%> (-0.24%) ⬇️
superset/utils/core.py 88.61% <0.00%> (-0.11%) ⬇️

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

Copy link
Member

@rusackas rusackas left a comment

Choose a reason for hiding this comment

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

Looks perfectly straightforward to me, but I'll let this bake a moment, in case anyone sees some random risk with this.

@villebro
Copy link
Member

villebro commented Dec 2, 2022

IIRC this happens when you flip the flag but don't restart your Celery process. I wonder if there's other problems that arise if Celery isn't restarted after enabling GAC..

@xneg
Copy link
Contributor Author

xneg commented Dec 3, 2022

@villebro I'm not sure. We deploy the whole installation including celery workers as a service in Kubernetes and redeploy it all together. Maybe the problem is with the order of pods restarting.

@villebro
Copy link
Member

villebro commented Dec 3, 2022

The order shouldn't matter, as the celery workers use the same config as the web workers (if you're using the default helm chart).

@rusackas rusackas merged commit a2a578a into apache:master Dec 22, 2022
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 labels Mar 13, 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/XS 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants