Skip to content

Commit ce4b837

Browse files
committed
wip! Trying to figure out what ref count of ext_session is
1 parent 15f6a6e commit ce4b837

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/blazingmq/_callbacks.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,14 @@ def on_message(
123123
user_callback(message, message_handle)
124124

125125
del message_handle # The message handle holds a reference to the extension session.
126-
if sys.getrefcount(ext_session) == 2: # covered in a subprocess # pragma: no cover
126+
ext_session_ref_count = sys.getrefcount(ext_session)
127+
if ext_session_ref_count == 2: # covered in a subprocess # pragma: no cover
127128
# Dropping our reference to the extension session will drop its reference count
128129
# to 0, calling __dealloc__ and stop() from its own background thread.
129130
print(
130-
"Deadlock detected by blazingmq after calling %s; aborting process."
131-
% user_callback,
131+
f"Deadlock detected by blazingmq after calling { user_callback } " +
132+
f"(ext_session ref count is { ext_session_ref_count }); " +
133+
f"aborting process.",
132134
file=sys.stderr,
133135
)
134136
try:

0 commit comments

Comments
 (0)