Skip to content

RuntimeError: can't start new thread #1

@bwduncan

Description

@bwduncan

Hi,

I'm using homemate-bridge 0.1.1 on a raspberry pi with three orvibo sockets (B20UK I think). After a while (it's been running for 24 days), I start seeing lots of these exceptions in the logs:

Traceback (most recent call last):
File "/usr/lib/python3.5/socketserver.py", line 313, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python3.5/socketserver.py", line 636, in process_request
t.start()
File "/usr/lib/python3.5/threading.py", line 844, in start
_start_new_thread(self._bootstrap, ())
RuntimeError: can't start new thread

It looks like each socket is opening a new TCP connection every few hours (the time between connections is quite irregular, usually not less than an hour, usually not more than 6 hours).

Currently homemate-bridge has 250 TCP connections open, and 251 threads.

I appreciate that this might be difficult to reproduce, and I'm not sure what the fix is: Perhaps closing connections which haven't seen any traffic for hours is an easy fix? That would simply involve setting the timeout attribute to a number of seconds (3600, one hour?) on the server object in main. What do you think?

Thanks,
Bruce

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions