sentry-python: exiting `with push_scope()` fails if new client is bound
Similarly to https://github.com/getsentry/sentry-python/issues/147, we started to get popped wrong scope assertion errors in a Falcon app sending jobs to redis-queue after updating to sentry-sdk from raven
Our Python 3.5.2 stack:
rq==0.12.0
redis==2.10.6
sentry-sdk==0.5.2
The worker is initialized like this:
listen = [l.value for l in constants.QueueList]
conn = redis.from_url(os.environ.get(
'REDIS_WORKER', 'redis://redis_worker:6379'))
sentry_sdk.init(sentry_key,
environment=environment,
release=release,
integrations=[RqIntegration()])
with Connection(conn):
worker = Worker(list(map(Queue, listen)))
worker.work(logging_level='WARNING')
If it’s the same kind of issue, would a change from:
with hub.push_scope() as scope:
scope.add_event_processor(_make_event_processor(weakref.ref(job)))
rv = old_perform_job(self, job, *args, **kwargs)
to
with Hub(hub) as hub:
with hub.configure_scope() as scope:
scope.add_event_processor(_make_event_processor(weakref.ref(job)))
rv = old_perform_job(self, job, *args, **kwargs)
in https://github.com/getsentry/sentry-python/blob/master/sentry_sdk/integrations/rq.py#L28 do the job ?
If not, I’d be happy to provide more info
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 21 (11 by maintainers)
Commits related to this issue
- fix: Dont crash when client is bound inside of push_scope See #159 — committed to getsentry/sentry-python by untitaker 6 years ago
- fix: Dont crash when client is bound inside of push_scope (#163) See #159 — committed to getsentry/sentry-python by untitaker 6 years ago
Cool, I’ll just release the bugfix then.