Opened 6 years ago

Closed 6 years ago

#13141 closed defect (fixed)

Stem : Too many open file error

Reported by: RSenet Owned by: atagar
Priority: Medium Milestone: Tor: unspecified
Component: Archived/Stem Version: Tor: unspecified
Severity: Keywords: Stem, python, tor, too many open file
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


If you launch many connection over Tor using stem and launch_tor_with_config function, you'll probably have an exception like :
OSError: [Errno 24] Too many open files

The problem is comming from this line:
torrc_path = tempfile.mkstemp(prefix = "torrc-", text = True)[1]

This exception is raise because "tempfile.mkstemp" create a file descriptor which is never closed in file.

To properly close tempile, you have to use this correction :
fileDescriptor, torrc_path = tempfile.mkstemp(prefix = 'torrc-', text = True)

Before delete the temp file, you just have to close the file descriptor:

Child Tickets

Change History (2)

comment:2 Changed 6 years ago by atagar

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.