Merge lp:~james-w/storm/ssl-disconnect-error into lp:storm

Proposed by James Westby
Status: Needs review
Proposed branch: lp:~james-w/storm/ssl-disconnect-error
Merge into: lp:storm
Diff against target: 40 lines (+12/-1)
2 files modified
storm/databases/postgres.py (+1/-0)
tests/databases/postgres.py (+11/-1)
To merge this branch: bzr merge lp:~james-w/storm/ssl-disconnect-error
Reviewer Review Type Date Requested Status
Storm Developers Pending
Review via email: mp+188933@code.launchpad.net

Commit message

Close the connection if there is a SSL connection closed error.

Description of the change

Hi,

We're seeing "OperationalError: SSL connection has been closed unexpectedly"
which is fatal to the connection, so add it to the list of disconnection errors.

Thanks,

James

To post a comment you must log in.

Unmerged revisions

466. By James Westby

Close the connection if there is a SSL connection closed error.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'storm/databases/postgres.py'
--- storm/databases/postgres.py 2012-04-04 23:44:02 +0000
+++ storm/databases/postgres.py 2013-10-02 21:35:37 +0000
@@ -316,6 +316,7 @@
316 return True316 return True
317 msg = str(exc)317 msg = str(exc)
318 return (318 return (
319 "SSL connection has been closed unexpectedly" in msg or
319 "SSL SYSCALL error" in msg or320 "SSL SYSCALL error" in msg or
320 "EOF detected" in msg or321 "EOF detected" in msg or
321 "connection already closed" in msg or322 "connection already closed" in msg or
322323
=== modified file 'tests/databases/postgres.py'
--- tests/databases/postgres.py 2012-06-12 10:00:51 +0000
+++ tests/databases/postgres.py 2013-10-02 21:35:37 +0000
@@ -28,7 +28,8 @@
28from storm.variables import DateTimeVariable, RawStrVariable28from storm.variables import DateTimeVariable, RawStrVariable
29from storm.variables import ListVariable, IntVariable, Variable29from storm.variables import ListVariable, IntVariable, Variable
30from storm.properties import Int30from storm.properties import Int
31from storm.exceptions import DisconnectionError31from storm.exceptions import (
32 DisconnectionError, OperationalError)
32from storm.expr import (Union, Select, Insert, Update, Alias, SQLRaw, State,33from storm.expr import (Union, Select, Insert, Update, Alias, SQLRaw, State,
33 Sequence, Like, Column, COLUMN)34 Sequence, Like, Column, COLUMN)
34from storm.tracer import install_tracer, TimeoutError35from storm.tracer import install_tracer, TimeoutError
@@ -579,6 +580,15 @@
579 exc = ProgrammingError("SSL SYSCALL error: Connection timed out")580 exc = ProgrammingError("SSL SYSCALL error: Connection timed out")
580 self.assertTrue(self.connection.is_disconnection_error(exc))581 self.assertTrue(self.connection.is_disconnection_error(exc))
581582
583 def test_is_disconnection_error_with_ssl_connection_closed(self):
584 """
585 If the underlying driver raises a OperationalError with 'SSL
586 connection has been closed unexpectedly', we consider the connection
587 dead and mark it as needing reconnection.
588 """
589 exc = OperationalError("SSL connection has been closed unexpectedly")
590 self.assertTrue(self.connection.is_disconnection_error(exc))
591
582592
583_max_prepared_transactions = None593_max_prepared_transactions = None
584594

Subscribers

People subscribed via source and target branches

to status/vote changes: