socket.error 24: too many open files

TheDavidFactor thedavidfactor at gmail.com
Wed Jan 7 13:32:34 EST 2009


I'm new to python, but have been writing programs in other languages
for about 15 years now. As part of my job I develop applications that
interface with Asterisk in various ways. As a way of getting my feet
wet I decided to try to rewrite an outbound call script that I have in
another language into python. It's a deamon that runs on a linux box
and every 15 seconds it checks a MySQL table for new records, if there
are any it creates a .call file on the Asterisk server using ssh, it
also checks the Asterisk server, again via ssh, for any finished calls
and if there are any it reads the .call file and writes the result in
to the MySQL table.

I did a google search for ssh and a python script that someone had
written that wraps up some paramiko calls to make the ssh interaction
easier. I'm also using MySQLdb for the MySQL access. It sleeps for 15
seconds then creates an ssh connection the asterisk server, checks the
MySQL table, checks the asterisk server, closes the connection and
goes back to sleep. After it has run for an hour or so I get the error
in the subject when the ssh class tries to create a new socket. I have
double checked that it is closing the socket. I don't know what else
to check, any suggestions would be much appreciated.



More information about the Python-list mailing list