mirrorprobe sometimes times out with an exception #46

Closed
poeml opened this Issue Jun 5, 2015 · 0 comments

1 participant

@poeml
Owner
                                                                                                    [          ]

Issue migrated (2015-06-05) from old issue tracker http://mirrorbrain.org/issues/issue46

Title    mirrorprobe sometimes times out with an exception
 Priority   bug               Status        resolved
Superseder                  Nosy List       poeml
Assigned To poeml            Keywords

msg165 (view) Author: poeml Date: 2010-03-27.15:10:53

There is a certain exception that the mirrorprobe might run into, which is not caught by the code,
even though it should. Symptom:

Exception in thread probeThread-273:
Traceback (most recent call last):
File "/usr/lib/python2.5/threading.py", line 486, in __bootstrap_inner
self.run()
File "/usr/lib/python2.5/threading.py", line 446, in run
self.__target(self.__args, *self.__kwargs)
File "/usr/bin/mirrorprobe", line 97, in probe_http
mirror.response = e.read()
File "/usr/lib/python2.5/socket.py", line 291, in read
data = self._sock.recv(recv_size)
File "/usr/lib/python2.5/httplib.py", line 509, in read
return self._read_chunked(amt)
File "/usr/lib/python2.5/httplib.py", line 544, in _read_chunked
line = self.fp.readline()
File "/usr/lib/python2.5/socket.py", line 331, in readline
data = recv(1)
timeout: timed out

The code does have exception handling for this case. However, the exception, which happens deep
in the socket module, is not correctly passed to upper layers. Thus, there doesn't seem to be a way
to get hold of it.

In trunk, I have now wrapped the entire thread code into another try-except block. That is ugtly,
but helps.

msg166 (view) Author: poeml Date: 2010-03-27.15:20:57

r8022 | poeml | 2010-03-27 16:19:13 +0100 (Sat, 27 Mar 2010) | 8 lines

mirrorprobe:

  • A hard-to-catch exception is now handled. If Python's socket module ran into a timeout while reading a chunked response, the exception would not be passed correctly to the upper layer, so it could not be caught by its name. We now wrap the entire thread into another exception, which would otherwise be bad practice, but is probably okay here, since we already catch all other exceptions.
History
         Date         User  Action            Args
2010-03-27 15:20:57 poeml set    status: testing -> resolved
                                   messages: + msg166
2010-03-27 15:10:54 poeml create

(end of migrated issue)
@poeml poeml added bug resolved labels Jun 5, 2015
@poeml poeml closed this Jun 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment