Skip to content

Conversation

@jairhenrique
Copy link
Contributor

No description provided.

@synweap15
Copy link
Collaborator

synweap15 commented Oct 7, 2025

So I guess we start raising an exception and halt the worker when hasattr(sys, "is_gil_enabled") and sys._is_gil_enabled() and the runner is dramatiq-gevent? @LincolnPuzey thoughts?

@LincolnPuzey LincolnPuzey changed the title Run tests on python 3.14 and 3.14 with free threads Run tests on python 3.14 with free threads Oct 8, 2025
@LincolnPuzey
Copy link
Collaborator

@synweap15

the worker-class is gevent?

Don't know what you mean by this

@LincolnPuzey
Copy link
Collaborator

Yes I believe that using gevent on free-threaded python is a no-go (https://www.gevent.org/install.html#supported-platforms).

Perhaps right at the start of the dramatiq-gevent entrypoint we can add a check and raise an exception if so.

@synweap15 Where did you get is_nogil_mode attribute from? I can't see it mentioned in the docs.

@LincolnPuzey
Copy link
Collaborator

The current passing tests are actually still running with the GIL enabled. From the test logs:

<frozen importlib._bootstrap>:491: RuntimeWarning: 
  The global interpreter lock (GIL) has been enabled 
  to load module '_pylibmc', which has not declared 
  that it can run safely without the GIL. To override 
  this behavior and keep the GIL disabled (at your own risk), 
  run with PYTHON_GIL=0 or -Xgil=0.

@synweap15
Copy link
Collaborator

@LincolnPuzey sorry, I recently work with a custom-patched CPython where is_nogil_mode is exposed.

The offical CPython way has been introduced in python/cpython#118514 - sys._is_gil_enabled(), reflecting the current state. I have updated my comment for clarity.

@Bogdanp
Copy link
Owner

Bogdanp commented Oct 8, 2025

I think we want to continue supporting gevent even in 3.14 and up. I think @LincolnPuzey meant that the check in dramatiq-gevent should raise an error if free threading is enabled.

Reading the gevent docs, though, my understanding is that using gevent will simply enable the GIL, so maybe a warning would be more appropriate when dramatiq-gevent is run in a free-threading Python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants