|
22 | 22 | import logging |
23 | 23 | import os |
24 | 24 | import platform |
| 25 | +import socket |
25 | 26 | import sys |
26 | 27 | import threading |
27 | 28 | import time |
@@ -418,17 +419,29 @@ def _TransmitBreakpointUpdates(self, service): |
418 | 419 | # not be retried. All other errors are assumed to be transient. |
419 | 420 | status = err.resp.status |
420 | 421 | is_transient = ((status >= 500) or (status == 408)) |
421 | | - if is_transient and retry_count < self.max_transmit_attempts - 1: |
422 | | - native.LogInfo('Failed to send breakpoint %s update: %s' % ( |
423 | | - breakpoint['id'], traceback.format_exc())) |
424 | | - retry_list.append((breakpoint, retry_count + 1)) |
425 | | - elif is_transient: |
426 | | - native.LogWarning( |
427 | | - 'Breakpoint %s retry count exceeded maximum' % breakpoint['id']) |
| 422 | + if is_transient: |
| 423 | + if retry_count < self.max_transmit_attempts - 1: |
| 424 | + native.LogInfo('Failed to send breakpoint %s update: %s' % |
| 425 | + (breakpoint['id'], traceback.format_exc())) |
| 426 | + retry_list.append((breakpoint, retry_count + 1)) |
| 427 | + else: |
| 428 | + native.LogWarning('Breakpoint %s retry count exceeded maximum' % |
| 429 | + breakpoint['id']) |
428 | 430 | else: |
429 | 431 | # This is very common if multiple instances are sending final update |
430 | 432 | # simultaneously. |
431 | 433 | native.LogInfo('%s, breakpoint: %s' % (err, breakpoint['id'])) |
| 434 | + except socket.error as err: |
| 435 | + if retry_count < self.max_transmit_attempts - 1: |
| 436 | + native.LogInfo( |
| 437 | + 'Socket error %d while sending breakpoint %s update: %s' % |
| 438 | + (err.errno, breakpoint['id'], traceback.format_exc())) |
| 439 | + retry_list.append((breakpoint, retry_count + 1)) |
| 440 | + else: |
| 441 | + native.LogWarning('Breakpoint %s retry count exceeded maximum' % |
| 442 | + breakpoint['id']) |
| 443 | + # Socket errors shouldn't persist like this; reconnect. |
| 444 | + reconnect = True |
432 | 445 | except BaseException: |
433 | 446 | native.LogWarning( |
434 | 447 | 'Fatal error sending breakpoint %s update: %s' % ( |
|
0 commit comments