Merge lp:~stefan-opener/therp-backports/6.1-bug-905257-fix-reconnect into lp:therp-backports/server-6.1

Proposed by Stefan Rijnhart (Opener) on 2013-02-13
Status: Merged
Merged at revision: 4297
Proposed branch: lp:~stefan-opener/therp-backports/6.1-bug-905257-fix-reconnect
Merge into: lp:therp-backports/server-6.1
Diff against target: 43 lines (+11/-3)
2 files modified
openerp/sql_db.py (+10/-2)
setup.py (+1/-1)
To merge this branch: bzr merge lp:~stefan-opener/therp-backports/6.1-bug-905257-fix-reconnect
Reviewer Review Type Date Requested Status
Holger Brunn (Therp) 2013-02-13 Pending
Review via email: mp+148115@code.launchpad.net

Description of the change

This branch is now a verbatim backport of lp:openobject-addons/7.0 -r 4838..4840

To post a comment you must log in.

Setting to 'work in progress' as a simpler patch has been posted here: https://code.launchpad.net/~openerp-dev/openobject-server/7.0-rstcnx-chs

Reverted previous fix and applied fix that is now in OpenERP server 7.0

4299. By Olivier Dony (Odoo) on 2013-02-15

[FIX] sql_db: typo in previous patch for autodetection of closed connections

Hi Holger,

thank you for merging. Can you also approve the MP next time?

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openerp/sql_db.py'
2--- openerp/sql_db.py 2012-02-06 20:31:51 +0000
3+++ openerp/sql_db.py 2013-02-15 16:04:26 +0000
4@@ -3,7 +3,7 @@
5 #
6 # OpenERP, Open Source Management Solution
7 # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
8-# Copyright (C) 2010-2011 OpenERP s.a. (<http://openerp.com>).
9+# Copyright (C) 2010-2013 OpenERP s.a. (<http://openerp.com>).
10 #
11 # This program is free software: you can redistribute it and/or modify
12 # it under the terms of the GNU Affero General Public License as
13@@ -386,8 +386,16 @@
14 def borrow(self, dsn):
15 self._debug('Borrow connection to %r', dsn)
16
17- # free leaked connections
18+ # free dead and leaked connections
19 for i, (cnx, _) in tools.reverse_enumerate(self._connections):
20+ try:
21+ cnx.reset()
22+ except psycopg2.OperationalError:
23+ self._debug('Cannot reset connection at index %d: %r', i, cnx.dsn)
24+ # psycopg2 2.4.4 and earlier do not allow closing a closed connection
25+ if not cnx.closed:
26+ cnx.close()
27+
28 if cnx.closed:
29 self._connections.pop(i)
30 self._debug('Removing closed connection at index %d: %r', i, cnx.dsn)
31
32=== modified file 'setup.py'
33--- setup.py 2012-02-07 12:14:11 +0000
34+++ setup.py 2013-02-15 16:04:26 +0000
35@@ -100,7 +100,7 @@
36 'gdata',
37 'lxml',
38 'mako',
39- 'psycopg2',
40+ 'psycopg2 >= 2.2',
41 'pydot',
42 'python-dateutil < 2',
43 'python-ldap',

Subscribers

People subscribed via source and target branches