Python Forum
Error: can't start new thread
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error: can't start new thread
#1
Hi!
When creating an instance of the pymongo.MongoClient class, I have the following error at irregular intervals:

Error:
... File "/srv/foo/src/bar.mongodb.core/bar/mongodb/core/clients.py", line 78, in get_client db_clients_uri[key] = pymongo.MongoClient(host) File "/home/foo/src/pymongo-3.12.1-py3.6-linux-x86_64.egg/pymongo/mongo_client.py", line 779, in __init__ self._get_topology() File "/home/foo/src/pymongo-3.12.1-py3.6-linux-x86_64.egg/pymongo/mongo_client.py", line 1297, in _get_topology self._kill_cursors_executor.open() File "/home/foo/src/pymongo-3.12.1-py3.6-linux-x86_64.egg/pymongo/periodic_executor.py", line 87, in open thread.start() File "/home/foo/src/Python-3.6/lib/python3.6/threading.py", line 846, in start _start_new_thread(self._bootstrap, ()) RuntimeError: can't start new thread
To investigate, I have included a log in threading.py at the appropriate point in the exception handling of the handler 'start':

from logging import getLogger
logger = getLogger('threading')
try:
    import subprocess
    total, used, free = map(
        int, subprocess.check_output(['free', '-t']).splitlines()[-1].split()[1:])
    logger.error('### RAM memory used: {} %'.format(str(round((used/total) * 100, 2))))
    import threading
    logger.error('### PYTHON threads: '+str(threading.active_count()))
except Exception as err:
    logger.error('### RAM memory error '+str(err))
In the logs I have the following result:
RAM memory error [Errno 11] Resource temporarily unavailable

Can the log output be interpreted unambiguously?
a) When calling subprecess.check_output(), it is simply no longer possible to create new threads due to the thread problem or
b) the RAM limit has been reached or
c) ?

Thank you very much!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Cant find root cause of thread.lock error burlyboys 0 1,563 May-18-2020, 12:51 PM
Last Post: burlyboys
  Error SQLite objects created in a thread can only be used in that same thread. binhduonggttn 3 15,606 Jan-31-2020, 11:08 AM
Last Post: DeaD_EyE
Exclamation Error: There is no current event loop in thread 'MainThread' AlekseyPython 5 15,920 Feb-21-2019, 04:37 AM
Last Post: AlekseyPython
  What's the difference b/w assigning start=None and start=" " Madara 1 2,329 Aug-06-2018, 08:23 AM
Last Post: buran
  how to start a seperate thread for every item in a list lravikumarvsp 1 2,931 May-31-2018, 08:07 AM
Last Post: ThiefOfTime

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020