Merge lp:~wgrant/launchpad/bug-1408557-mitigate into lp:launchpad

Proposed by William Grant
Status: Merged
Merged at revision: 17301
Proposed branch: lp:~wgrant/launchpad/bug-1408557-mitigate
Merge into: lp:launchpad
Diff against target: 14 lines (+3/-1)
1 file modified
lib/lp/services/librarianserver/storage.py (+3/-1)
To merge this branch: bzr merge lp:~wgrant/launchpad/bug-1408557-mitigate
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+246022@code.launchpad.net

Commit message

Mitigate librarian swift FD leaks (bug #1408557) by reusing connections on 404.

Description of the change

Mitigate librarian swift FD leaks (bug #1408557) by reusing connections on 404.

This isn't a complete fix, but it's worked on production for a couple of days.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/services/librarianserver/storage.py'
2--- lib/lp/services/librarianserver/storage.py 2014-10-17 09:21:23 +0000
3+++ lib/lp/services/librarianserver/storage.py 2015-01-09 23:17:01 +0000
4@@ -99,7 +99,9 @@
5 swift_stream = TxSwiftStream(swift_connection, chunks)
6 defer.returnValue(swift_stream)
7 except swiftclient.ClientException as x:
8- if x.http_status != 404:
9+ if x.http_status == 404:
10+ swift.connection_pool.put(swift_connection)
11+ else:
12 self.swift_download_fails += 1
13 log.err(x)
14 except Exception as x: