You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AttributeError: 'dict' object has no attribute 'f_back' in profiler thread #1958
The profiler thread (<Thread(sentry.profiler.ThreadScheduler, started daemon 140454125577984)>) fails this stack trace:
AttributeError: 'dict' object has no attribute 'f_back'
File "threading.py", line 975, in run
self._target(*self._args, **self._kwargs)
Unfortunately there is no more information. It looks like the full stack trace is not captured / lost, perhaps because this is an exception within a thread?
Full screenshot from Sentry UI:
It's not clear from a quick glance at the source how a dict could be ending up in the profiler thread's queue.
traces_sampler returns 0.0 for some high traffic paths that don't need profiling, like the heartbeat url.
* Do you do any monkey patching in your application? Or is there some monkey patching happening from a package you use?
It's hard to audit for monkey patching, but I've grepped. I don't see any monkey patching of things from sentry_sdk or threading. There’s one patch on requests as per my blog post but that doesn't seem relevant here.
@LiveNL@adamchainz One follow-up question for the two of you. Is this error preventing you from collecting profiles completely? Or is it happening occasionally and you are still able to collect some profiles?
Yeah, I noticed that in another report. It's not clear to me how this can be happening as I cannot reproduce it. The only thing in common from all the reports so far is that they're all from Python 3.11 which may have some edge case where the API is not returning what is expected. I have #1965 to handle these errors as there's not really anything to be done when the data being returned is bad.
@LiveNL@adamchainz One follow-up question for the two of you. Is this error preventing you from collecting profiles completely? Or is it happening occasionally and you are still able to collect some profiles?
Same here, only happening occassionally. The profiling dash has thousands of transactions but this error has occurred 33 times.
Also from the breadcrumbs I can tell it normally occurs a while from the server process startup, sometimes many hours.
It may be related to Python's shutdown procedure, where threads may still be running whilst objects and classes start getting cleaned up, which could lead to attributes seeming gone or types changed?
Activity
antonpirker commentedon Mar 16, 2023
Hey @adamchainz !
Thanks for reporting this. We will see if we can reproduce this!
Zylphrex commentedon Mar 16, 2023
Hey @adamchainz, are you able to share the following?
sentry_sdk.initlook like?adamchainz commentedon Mar 17, 2023
Django
Gunicorn
sentry_before_sendjust dropsKeyboardInterrupttraces_samplerreturns 0.0 for some high traffic paths that don't need profiling, like the heartbeat url.It's hard to audit for monkey patching, but I've grepped. I don't see any monkey patching of things from
sentry_sdkorthreading. There’s one patch on requests as per my blog post but that doesn't seem relevant here.LiveNL commentedon Mar 20, 2023
Not sure if helpful, but we've had the same issue also using
gunicornbut instead of Django we use Flask (with python 3.11).Our init looks like:
We went back to 1.15.0, which resolved the issues for us.
Zylphrex commentedon Mar 20, 2023
Thanks for the additional info! That's helpful to know
Zylphrex commentedon Mar 20, 2023
@LiveNL @adamchainz One follow-up question for the two of you. Is this error preventing you from collecting profiles completely? Or is it happening occasionally and you are still able to collect some profiles?
LiveNL commentedon Mar 20, 2023
The latter for us.
Btw. the error presented itself in a few different shapes besides

'dict' object ...:Zylphrex commentedon Mar 20, 2023
Yeah, I noticed that in another report. It's not clear to me how this can be happening as I cannot reproduce it. The only thing in common from all the reports so far is that they're all from Python 3.11 which may have some edge case where the API is not returning what is expected. I have #1965 to handle these errors as there's not really anything to be done when the data being returned is bad.
adamchainz commentedon Mar 20, 2023
Same here, only happening occassionally. The profiling dash has thousands of transactions but this error has occurred 33 times.
Also from the breadcrumbs I can tell it normally occurs a while from the server process startup, sometimes many hours.
It may be related to Python's shutdown procedure, where threads may still be running whilst objects and classes start getting cleaned up, which could lead to attributes seeming gone or types changed?
Zylphrex commentedon Mar 20, 2023
Yeah, that's possible. In either case, it should be safe to handle these errors and ignore these samples like in the PR I linked.