~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/medium.py

  • Committer: John Arbash Meinel
  • Date: 2011-09-14 13:47:07 UTC
  • mto: (6133.4.49 2.5-soft-hangup-795025)
  • mto: This revision was merged to the branch mainline in revision 6170.
  • Revision ID: john@arbash-meinel.com-20110914134707-sx18ml5ey5o3wv38
Don't traceback for timeouts, and give better documentation about why we don't just select.

Show diffs side-by-side

added added

removed removed

Lines of Context:
231
231
                self._serve_one_request(server_protocol)
232
232
        except errors.ConnectionTimeout, e:
233
233
            trace.note('%s' % (e,))
 
234
            trace.log_exception_quietly()
234
235
            self._close()
235
 
            raise
 
236
            # We reported it, no reason to make a big fuss.
 
237
            return
236
238
        except Exception, e:
237
239
            stderr.write("%s terminating on exception %s\n" % (self, e))
238
240
            raise
288
290
                or timeout_seconds <= self._stream_medium_fast_timeout):
289
291
                rs, _, _ = select.select([fd], [], [], timeout_seconds)
290
292
            else:
291
 
                # For some reason select.select() during the test suite may
292
 
                # sometimes pause until timeout triggers. However, if we call
293
 
                # it again, it correctly determines that rs is no longer
294
 
                # blocking. So we set a short select() timeout, but pause
295
 
                # overall until the timeout finishes
 
293
                # It looks like during the test suite, we close the server-side
 
294
                # socket as part of 'shut down this server'. Depending on how
 
295
                # we race with select.select, that either
 
296
                # 1) Raises socket.error(EBADF) immediately
 
297
                # 2) Occasionally (1 in 1000 or so) raises select.error(EBADF)
 
298
                # 3) 1-in-3 or so times out, calling select.select immediately
 
299
                #    afterwards seems to raise EBADF.
 
300
                # I think what happens is select.select is unable to see the
 
301
                # status of a file that is closed after it starts 'sleeping'.
296
302
                t_end = time.time() + timeout_seconds
297
303
                rs = []
298
304
                while not rs and time.time() < t_end: