SynchronousOnlyOperation from celery task using gevent execution pool

I opened an issue about a library I’m using for my django project, here’s the link: Async DataBaseHandler (Sink?) Django · Issue #879 · Delgan/loguru · GitHub
Searching the internet I found a question on stackoverflow which describes exactly what happens: django - SynchronousOnlyOperation from celery task using gevent execution pool - Stack Overflow

commands:

celery==5.2.7
django==3.2.19

celery -A scheduler.celery beat -l INFO --uid=nobody --gid=nogroup --detach
celery -A scheduler.celery worker -l INFO -E --uid=nobody --gid=nogroup -O fair --pool=gevent --hostname=celery-workerAnalyser --autoscale=30,10

The main question is: But why isn’t this exception raised in 100% of cases but only in a minority of cases?

The accepted answer on the SO thread has this:

It turned out my assumptions were wrong and I was using code which was not greenlet safe with gevent.

I’d guess you’d have to ask on gevent what that means. (I have to admit to having no idea myself. :sweat_smile:)

This isn’t really a Django question I think…

I was wondering if queries made via Models could be greenlet safe with gevent