pymongo and subinterpreters

27 views
Skip to first unread message

Patrice Espié

unread,
Aug 22, 2018, 4:45:32 AM8/22/18
to mongodb-user
Hi All,

I get a huge problem when using pymongo in my product: we use subinterpreters (Python3), and when closing a subinterpreter, I get an error telling there is at least one (daemon) thread still running.
It would be nice if I could have a way to fully stop pymongo (I cannot use it right now without this capability).

Thanks a lot!
Patrice

Bernie Hackett

unread,
Aug 22, 2018, 11:13:37 AM8/22/18
to mongodb-user
Call MongoClient.close(). That shuts down all of the background threads.

Patrice Espié

unread,
Aug 23, 2018, 4:17:04 AM8/23/18
to mongod...@googlegroups.com
Hi Bernie,

Thanks for your fast answer!
I obviously tried to close() my client, and this does not close daemon thread at all... This is why I asked on the forum.

To be very precise, I obtain this error:
     "Py_EndInterpreter: not the last thread"
in the fonction "Py_EndInterpreter"

So I guess there is a bug in close() function, which does not do the whole job.

Am I wrong?

Thanks a lot for your help
Patrice

--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/1734e47e-02c3-4222-b83e-e6716cd19cb9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shane Harvey

unread,
Aug 24, 2018, 6:17:54 PM8/24/18
to mongodb-user
Hi Patrice,

MongoClient.close() indeed does not join() its background threads, instead it asynchronously tells them to exit "soon". I opened https://jira.mongodb.org/browse/PYTHON-1634 for us to provide a better way to ensure all background threads have exited. For now I can only suggest to sleep for a few seconds after calling MongoClient.close(). Can we continue this discussion on the Jira ticket?
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages