diff options
Diffstat (limited to 'src/s3ql/backends')
-rw-r--r-- | src/s3ql/backends/s3c.py | 19 | ||||
-rw-r--r-- | src/s3ql/backends/swift.py | 20 |
2 files changed, 38 insertions, 1 deletions
diff --git a/src/s3ql/backends/s3c.py b/src/s3ql/backends/s3c.py index c5b84d7..5fba441 100644 --- a/src/s3ql/backends/s3c.py +++ b/src/s3ql/backends/s3c.py @@ -530,10 +530,29 @@ class ObjectR(object): if not buf and not self.md5_checked: etag = self.resp.getheader('ETag').strip('"') self.md5_checked = True + + # Apparently sometimes the response is not closed even when all data has been read. In + # that case, the next request can still be send, but an attempt to retrieve the next + # response will result in an ResponseNotReady() exception: + # http://code.google.com/p/s3ql/issues/detail?id=358 + # This code attempts to produce additional debug information when that happens, + # so that we can figure out what exactly is going wrong. + if not self.resp.isclosed(): + log.error('ObjectR.read(): response not closed after end of data, ' + 'please report on http://code.google.com/p/s3ql/issues/') + log.error('Method: %s, chunked: %s, read length: %s ' + 'response length: %s, chunk_left: %s, status: %d ' + 'reason "%s", version: %s, will_close: %s', + self.resp._method, self.resp.chunked, size, self.resp.length, + self.resp.chunk_left, self.resp.status, self.resp.reason, + self.resp.version, self.resp.will_close) + self.resp.close() + if etag != self.md5.hexdigest(): log.warn('ObjectR(%s).close(): MD5 mismatch: %s vs %s', self.key, etag, self.md5.hexdigest()) raise BadDigest('BadDigest', 'ETag header does not agree with calculated MD5') + return buf self.md5.update(buf) diff --git a/src/s3ql/backends/swift.py b/src/s3ql/backends/swift.py index ae4b9ab..f2fe4b7 100644 --- a/src/s3ql/backends/swift.py +++ b/src/s3ql/backends/swift.py @@ -172,7 +172,7 @@ class Backend(AbstractBackend): headers['content-length'] = '0' if self.conn is None: - log.info('_do_request(): no active connection, calling _get_conn()') + log.debug('_do_request(): no active connection, calling _get_conn()') self.conn = self._get_conn() # Construct full path @@ -541,6 +541,24 @@ class ObjectR(object): if not buf and not self.md5_checked: etag = self.resp.getheader('ETag').strip('"') self.md5_checked = True + + # Apparently sometimes the response is not closed even when all data has been read. In + # that case, the next request can still be send, but an attempt to retrieve the next + # response will result in an ResponseNotReady() exception: + # http://code.google.com/p/s3ql/issues/detail?id=358 + # This code attempts to produce additional debug information when that happens, + # so that we can figure out what exactly is going wrong. + if not self.resp.isclosed(): + log.error('ObjectR.read(): response not closed after end of data, ' + 'please report on http://code.google.com/p/s3ql/issues/') + log.error('Method: %s, chunked: %s, read length: %s ' + 'response length: %s, chunk_left: %s, status: %d ' + 'reason "%s", version: %s, will_close: %s', + self.resp._method, self.resp.chunked, size, self.resp.length, + self.resp.chunk_left, self.resp.status, self.resp.reason, + self.resp.version, self.resp.will_close) + self.resp.close() + if etag != self.md5.hexdigest(): log.warn('ObjectR(%s).close(): MD5 mismatch: %s vs %s', self.key, etag, self.md5.hexdigest()) |