On 13.06.26 4:07 AM, Christopher Obbard wrote:
> Hello,
>
> On Fri, 20 Feb 2026 17:45:49 +0100 Gena Byers <[email protected]>
> wrote:
>> On 2/20/26 5:22 PM, Andrej Shadura wrote:
>>> Control: reassign -1 src:sentry-python
>>>
>>> Hello,
>>>
>>> On Fri, 20 Feb 2026, at 17:15, Gena Byers wrote:
>>>> On 2/20/26 4:54 PM, Andrej Shadura wrote:
>>>>> Can you give me more details please?
>>>>> I don’t see any mentions of this anywhere in the source.
>>>
>>>> I don't know what the exact mechanism is but installing python3-eventlet
>>>> renders matrix-synapse inoperable:
>>>
>>>> "/usr/lib/python3/dist-packages/sentry_sdk/utils.py", line 1346, in
>>>> _get_contextvars
>>>> Feb 20 16:59:17 nexus python3[2979902]: if not
>>>> _is_contextvars_broken():
>>>> Feb 20 16:59:17 nexus python3[2979902]: ~~~~~~~~~~~~~~~~~~~~~~^^
>>>> Feb 20 16:59:17 nexus python3[2979902]: File
>>>> "/usr/lib/python3/dist-packages/sentry_sdk/utils.py", line 1287, in
>>>> _is_contextvars_broken
>>>> Feb 20 16:59:17 nexus python3[2979902]: from eventlet.patcher import
>>>> is_monkey_patched # type: ignore
>>>
>>> Looks like something in the sentry SDK (which I think you should have
>>> mentioned you enabled).
>>>
>> I do have python3-sentry-sdk installed because it's a dependency of an
>> unrelated package but I have no idea what that is or what I did to
>> "enable" it. Removing python3-sentry-sdk makes matrix-synapse work again
>> even with python3-eventlet installed so I guess both have to be
>> installed to trigger it.
>
> I recently uploaded some new versions of sentry-python, can you please test
> this bug again?
>
> For reference, I tested this bug very quickly here and couldn't reproduce it.
>
> Sentry is only used in matrix-synapse if it is enabled in the config.
> Otherwise, it is not imported
> at all:
> https://github.com/element-hq/synapse/blob/d7e9a3ff8321fa820f38c17a4484f0437233cebb/synapse/app/_base.py#L830
>
> To "enable" sentry in matrix-synapse you need to have something like this in
> your
> config (/etc/matrix-synapse/homeserver.yaml):
>
> sentry:
> environment: production
> dsn: '...'
>
>
> AFAICT, the default configuration in Debian does NOT set the sentry
> configuration,
> so by default really you shouldn't be hitting this path.
>
> Can you check if you setup sentry at all in the synapse configuration?
> I guess we should add python3-sentry-sdk as a runtime-dep to matrix-synapse
> as well, since it can be enabled at runtime.
>
>
> Cheers!
>
> Chris
I don't have something like that in my configuration. Having both
python3-sentry-sdk (2.60.0-3) and python3-eventlet (0.40.4-1) installed
still renders matrix-synapse inoperable:
> Jun 19 20:29:28 nexus python3[1739712]: Traceback (most recent call last):
> Jun 19 20:29:28 nexus python3[1739712]: File "<frozen runpy>", line 194, in
> _run_module_as_main
> Jun 19 20:29:28 nexus python3[1739712]: File "<frozen runpy>", line 114, in
> _get_module_details
> Jun 19 20:29:28 nexus python3[1739712]: File
> "/usr/lib/python3/dist-packages/synapse/app/__init__.py", line 30, in <module>
> Jun 19 20:29:28 nexus python3[1739712]:
> check_dependencies.check_requirements()
> Jun 19 20:29:28 nexus python3[1739712]:
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
> Jun 19 20:29:28 nexus python3[1739712]: File
> "/usr/lib/python3/dist-packages/synapse/util/check_dependencies.py", line
> 330, in check_requirements
> Jun 19 20:29:28 nexus python3[1739712]: m = import_module(n)
> Jun 19 20:29:28 nexus python3[1739712]: File
> "/usr/lib/python3.13/importlib/__init__.py", line 88, in import_module
> Jun 19 20:29:28 nexus python3[1739712]: return
> _bootstrap._gcd_import(name[level:], package, level)
> Jun 19 20:29:28 nexus python3[1739712]:
> ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Jun 19 20:29:28 nexus python3[1739712]: File
> "/usr/lib/python3/dist-packages/sentry_sdk/__init__.py", line 1, in <module>
> Jun 19 20:29:28 nexus python3[1739712]: from sentry_sdk import profiler
> Jun 19 20:29:28 nexus python3[1739712]: File
> "/usr/lib/python3/dist-packages/sentry_sdk/profiler/__init__.py", line 1, in
> <module>
> Jun 19 20:29:28 nexus python3[1739712]: from
> sentry_sdk.profiler.continuous_profiler import (
> Jun 19 20:29:28 nexus python3[1739712]: ...<4 lines>...
> Jun 19 20:29:28 nexus python3[1739712]: )
> Jun 19 20:29:28 nexus python3[1739712]: File
> "/usr/lib/python3/dist-packages/sentry_sdk/profiler/continuous_profiler.py",
> line 13, in <module>
> Jun 19 20:29:28 nexus python3[1739712]: from sentry_sdk.envelope import
> Envelope
> Jun 19 20:29:28 nexus python3[1739712]: File
> "/usr/lib/python3/dist-packages/sentry_sdk/envelope.py", line 5, in <module>
> Jun 19 20:29:28 nexus python3[1739712]: from sentry_sdk.session import
> Session
> Jun 19 20:29:28 nexus python3[1739712]: File
> "/usr/lib/python3/dist-packages/sentry_sdk/session.py", line 4, in <module>
> Jun 19 20:29:28 nexus python3[1739712]: from sentry_sdk.utils import
> format_timestamp
> Jun 19 20:29:28 nexus python3[1739712]: File
> "/usr/lib/python3/dist-packages/sentry_sdk/utils.py", line 1464, in <module>
> Jun 19 20:29:28 nexus python3[1739712]: HAS_REAL_CONTEXTVARS, ContextVar
> = _get_contextvars()
> Jun 19 20:29:28 nexus python3[1739712]:
> ~~~~~~~~~~~~~~~~^^
> Jun 19 20:29:28 nexus python3[1739712]: File
> "/usr/lib/python3/dist-packages/sentry_sdk/utils.py", line 1434, in
> _get_contextvars
> Jun 19 20:29:28 nexus python3[1739712]: if not _is_contextvars_broken():
> Jun 19 20:29:28 nexus python3[1739712]: ~~~~~~~~~~~~~~~~~~~~~~^^
> Jun 19 20:29:28 nexus python3[1739712]: File
> "/usr/lib/python3/dist-packages/sentry_sdk/utils.py", line 1381, in
> _is_contextvars_broken
> Jun 19 20:29:28 nexus python3[1739712]: from eventlet.patcher import
> is_monkey_patched # type: ignore
> Jun 19 20:29:28 nexus python3[1739712]:
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Jun 19 20:29:28 nexus python3[1739712]: File
> "/usr/lib/python3/dist-packages/eventlet/__init__.py", line 6, in <module>
> Jun 19 20:29:28 nexus python3[1739712]: from eventlet import convenience
> Jun 19 20:29:28 nexus python3[1739712]: File
> "/usr/lib/python3/dist-packages/eventlet/convenience.py", line 7, in <module>
> Jun 19 20:29:28 nexus python3[1739712]: from eventlet.green import socket
> Jun 19 20:29:28 nexus python3[1739712]: File
> "/usr/lib/python3/dist-packages/eventlet/green/socket.py", line 21, in
> <module>
> Jun 19 20:29:28 nexus python3[1739712]: from eventlet.support import
> greendns
> Jun 19 20:29:28 nexus python3[1739712]: File
> "/usr/lib/python3/dist-packages/eventlet/support/greendns.py", line 78, in
> <module>
> Jun 19 20:29:28 nexus python3[1739712]: setattr(dns, pkg,
> import_patched('dns.' + pkg))
> Jun 19 20:29:28 nexus python3[1739712]:
> ~~~~~~~~~~~~~~^^^^^^^^^^^^^^
> Jun 19 20:29:28 nexus python3[1739712]: File
> "/usr/lib/python3/dist-packages/eventlet/support/greendns.py", line 60, in
> import_patched
> Jun 19 20:29:28 nexus python3[1739712]: return
> patcher.import_patched(module_name, **modules)
> Jun 19 20:29:28 nexus python3[1739712]:
> ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
> Jun 19 20:29:28 nexus python3[1739712]: File
> "/usr/lib/python3/dist-packages/eventlet/patcher.py", line 136, in
> import_patched
> Jun 19 20:29:28 nexus python3[1739712]: return inject(
> Jun 19 20:29:28 nexus python3[1739712]: module_name, None,
> *additional_modules + tuple(kw_additional_modules.items())
> Jun 19 20:29:28 nexus python3[1739712]: )
> Jun 19 20:29:28 nexus python3[1739712]: File
> "/usr/lib/python3/dist-packages/eventlet/patcher.py", line 113, in inject
> Jun 19 20:29:28 nexus python3[1739712]: module = __import__(module_name,
> {}, {}, module_name.split(".")[:-1])
> Jun 19 20:29:28 nexus python3[1739712]: File
> "/usr/lib/python3/dist-packages/dns/asyncquery.py", line 34, in <module>
> Jun 19 20:29:28 nexus python3[1739712]: import dns.quic
> Jun 19 20:29:28 nexus python3[1739712]: File
> "/usr/lib/python3/dist-packages/dns/quic/__init__.py", line 40, in <module>
> Jun 19 20:29:28 nexus python3[1739712]: import trio
> Jun 19 20:29:28 nexus python3[1739712]: File
> "/usr/lib/python3/dist-packages/trio/__init__.py", line 25, in <module>
> Jun 19 20:29:28 nexus python3[1739712]: from . import abc, from_thread,
> lowlevel, socket, to_thread
> Jun 19 20:29:28 nexus python3[1739712]: File
> "/usr/lib/python3/dist-packages/trio/socket.py", line 16, in <module>
> Jun 19 20:29:28 nexus python3[1739712]: from . import _socket
> Jun 19 20:29:28 nexus python3[1739712]: File
> "/usr/lib/python3/dist-packages/trio/_socket.py", line 546, in <module>
> Jun 19 20:29:28 nexus python3[1739712]: class SocketType:
> Jun 19 20:29:28 nexus python3[1739712]: ...<221 lines>...
> Jun 19 20:29:28 nexus python3[1739712]: raise
> NotImplementedError
> Jun 19 20:29:28 nexus python3[1739712]: File
> "/usr/lib/python3/dist-packages/trio/_socket.py", line 759, in SocketType
> Jun 19 20:29:28 nexus python3[1739712]:
> @_wraps(_stdlib_socket.socket.sendmsg, assigned=(), updated=())
> Jun 19 20:29:28 nexus python3[1739712]:
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Jun 19 20:29:28 nexus python3[1739712]: AttributeError: type object
> 'GreenSocket' has no attribute 'sendmsg'
> Jun 19 20:29:29 nexus systemd[1]: matrix-synapse.service: Control process
> exited, code=exited, status=1/FAILURE