gaierror: (8, 'hostname nor servname provided, or not known')

L

Laszlo Nagy

Hello,

I asked this question about a week ago, but I did not provide a
traceback. Here is the traceback:

File "/usr/local/lib/python2.4/xmlrpclib.py", line 1096, in __call__
return self.__send(self.__name, args)
File "/usr/local/lib/python2.4/xmlrpclib.py", line 1383, in __request
verbose=self.__verbose
File "/usr/local/lib/python2.4/xmlrpclib.py", line 1129, in request
self.send_content(h, request_body)
File "/usr/local/lib/python2.4/xmlrpclib.py", line 1243, in send_content
connection.endheaders()
File "/usr/local/lib/python2.4/httplib.py", line 798, in endheaders
self._send_output()
File "/usr/local/lib/python2.4/httplib.py", line 679, in _send_output
self.send(msg)
File "/usr/local/lib/python2.4/httplib.py", line 646, in send
self.connect()
File "/usr/local/lib/python2.4/httplib.py", line 1072, in connect
sock.connect((self.host, self.port))
File "<string>", line 1, in connect
gaierror: (8, 'hostname nor servname provided, or not known')

The program is connecting to the same host about 2 times per minute.
After running for one or two hours, it raises this exception. Once it
raised this exception, it keeps raising in. (My program is trying to
connect but it cannot.) Then I restart my program and it works for
anoter hour or two. I tried the same program on different machines and
different operating system, but the error is always the same. Please
help me identify the problem.

Thanks,

Laszlo
 
F

faulkner

my boss has a similar problem with his home internet connection in
general. he traced it back to his router, which was in the first couple
generations of routers. how old are the routers you tested this on?
aside from upgrading them, if they are the problem, i can suggest a
workaround.
the first time this exception is raised, your script can automatically
restart itself.
os.system('python -c "import time, os; time.sleep(2);
os.system(\'python yourscriptname.py &\')" &')
sys.exit(1)
 
L

Laszlo Nagy

faulkner írta:
my boss has a similar problem with his home internet connection in
general. he traced it back to his router, which was in the first couple
generations of routers. how old are the routers you tested this on?
aside from upgrading them, if they are the problem, i can suggest a
workaround.
the first time this exception is raised, your script can automatically
restart itself.
os.system('python -c "import time, os; time.sleep(2);
os.system(\'python yourscriptname.py &\')" &')
sys.exit(1)
My router is a FreeBSD 6.0 system. I'm running a named server on it,
that is our name server on the LAN. The OS was upgraded some months ago.
I tried the same program from a windows system and from other networks
(located in two other countries). I believe this problem is with Python.
However, your idea is fine. I thought the same. Just there is one
problem that hardens me this way. The exception happens in a working
thread. My program has lots of threads and is not supposed to be
terminated from working threads. Calling sys.exit will not be enough.

Well looks like I must do something similar but I do not like the idea.
It is very dirty and non-pythonic.

Best,

Laszlo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top