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
Nothing happens. No errors thrown. No clear documentation for that problem. Here issue for eventlet.
If sentry_sdk can't be used with eventlet and there no possible way to combine them it should be in documentation.
Please correct me if i'm missing something.
However, flush etc should not really break regardless of whether contextvars or thread locals are used. So I think it's more related to threading patches that would affect sentry_sdk.worker.
<sentry_sdk.client._Client object at 0x7f5d8354edf0>
Sentry is attempting to send 0 pending error messages
Waiting up to 2 seconds
Press Ctrl-C to quit
It also easy to reproduce on your machine using code sample in issue description. I'm using latest stable versions of packages
I'm getting the following recursionerror in addition when it's broken. As you said, if I move the SDK import after the monkeypatch, the issue disappears. You need to add debug=True to the init() call to see the stacktrace.
Traceback (most recent call last):
File "/Users/untitaker/projects/sentry-python/sentry_sdk/transport.py", line 326, in send_event_wrapper
self._send_event(event)
File "/Users/untitaker/projects/sentry-python/sentry_sdk/transport.py", line 232, in _send_event
self._send_request(
File "/Users/untitaker/projects/sentry-python/sentry_sdk/transport.py", line 176, in _send_request
response = self._pool.request(
File "/Users/untitaker/projects/sentry-python/.tox/py3.9-flask-dev/lib/python3.9/site-packages/urllib3/request.py", line 78, in request
return self.request_encode_body(
File "/Users/untitaker/projects/sentry-python/.tox/py3.9-flask-dev/lib/python3.9/site-packages/urllib3/request.py", line 170, in request_encode_body
return self.urlopen(method, url, **extra_kw)
File "/Users/untitaker/projects/sentry-python/.tox/py3.9-flask-dev/lib/python3.9/site-packages/urllib3/poolmanager.py", line 375, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "/Users/untitaker/projects/sentry-python/.tox/py3.9-flask-dev/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "/Users/untitaker/projects/sentry-python/.tox/py3.9-flask-dev/lib/python3.9/site-packages/urllib3/connectionpool.py", line 382, in _make_request
self._validate_conn(conn)
File "/Users/untitaker/projects/sentry-python/.tox/py3.9-flask-dev/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
conn.connect()
File "/Users/untitaker/projects/sentry-python/.tox/py3.9-flask-dev/lib/python3.9/site-packages/urllib3/connection.py", line 392, in connect
self.ssl_context = create_urllib3_context(
File "/Users/untitaker/projects/sentry-python/.tox/py3.9-flask-dev/lib/python3.9/site-packages/urllib3/util/ssl_.py", line 303, in create_urllib3_context
context.options |= options
File "/Users/untitaker/.pyenv/versions/3.9.0/lib/python3.9/ssl.py", line 602, in options
super(SSLContext, SSLContext).options.__set__(self, value)
File "/Users/untitaker/.pyenv/versions/3.9.0/lib/python3.9/ssl.py", line 602, in options
super(SSLContext, SSLContext).options.__set__(self, value)
File "/Users/untitaker/.pyenv/versions/3.9.0/lib/python3.9/ssl.py", line 602, in options
super(SSLContext, SSLContext).options.__set__(self, value)
[Previous line repeated 479 more times]
RecursionError: maximum recursion depth exceeded
In addition, the issue can be reproduced without Sentry. The urllib3 usage is straight from their README:
I'm getting the following recursionerror in addition when it's broken. As you said, if I move the SDK import after the monkeypatch, the issue disappears. You need to add debug=True to the init() call to see the stacktrace.
This should be fixed in just released eventlet v0.30.2 but (AFAIK) is not related to current problem.
[before eventlet] Hub.current.client: <sentry_sdk.client._Client object at 0x10b2b6198>
[ after eventlet] Hub.current.client: <sentry_sdk.client._Client object at 0x10b2b6198>
At the very least, it refers to same object after patching, so that's something about thread locals. Still maybe thread locals are messed up in another place.
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀
Activity
untitaker commentedon Mar 1, 2021
Can you add
sentry_sdk.flush()as last line?Randomneo commentedon Mar 1, 2021
Same. Nothing happens. Without flush I got.
Program ends by itself instantly.
With flush. No output and no message in sentry
Randomneo commentedon Mar 1, 2021
Problem definitely in eventlet.monkey_patch() if that line is commented everything works fine.
temoto commentedon Mar 1, 2021
Just for record, copying workaround from our tracker.
Calling monkey_patch before even importing sentry_sdk works.
I understand it's well below acceptable and yet don't have a better solution right now.
Successful fix would start with analyzing what side effects are produced by
import sentry_sdkRandomneo commentedon Mar 1, 2021
@temoto Thanks alot. I had no idea that import sentry_sdk was the problem :)
untitaker commentedon Mar 1, 2021
only work on import is this:
sentry-python/sentry_sdk/utils.py
Line 840 in 37105d9
However, flush etc should not really break regardless of whether contextvars or thread locals are used. So I think it's more related to threading patches that would affect
sentry_sdk.worker.untitaker commentedon Mar 1, 2021
@Randomneo can you check
Hub.current.clientafter init? Maybe locals are broken in a really bad way.Randomneo commentedon Mar 2, 2021
@untitaker I not quite get how I supposed to check it. But this code outputs:
Output:
It also easy to reproduce on your machine using code sample in issue description. I'm using latest stable versions of packages
untitaker commentedon Mar 3, 2021
I'm getting the following recursionerror in addition when it's broken. As you said, if I move the SDK import after the monkeypatch, the issue disappears. You need to add
debug=Trueto theinit()call to see the stacktrace.In addition, the issue can be reproduced without Sentry. The urllib3 usage is straight from their README:
This will crash in the same way.
temoto commentedon Mar 3, 2021
@untitaker
This should be fixed in just released eventlet v0.30.2 but (AFAIK) is not related to current problem.
My two cents to checking
Hub.current.client:At the very least, it refers to same object after patching, so that's something about thread locals. Still maybe thread locals are messed up in another place.
untitaker commentedon Mar 3, 2021
0.30.2 exhibits the same problem for me. You need to both send an event via the SDK and have debug=True added
github-actions commentedon Dec 23, 2021
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you label it
Status: BacklogorStatus: In Progress, I will leave it alone ... forever!"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀
antonpirker commentedon Feb 21, 2022
Quick update: I think this is a important issue to improve sentry with async Python. I will try to review and test this.