Merge lp:~openerp-dev/openobject-server/6.0-opw-6168-ach into lp:openobject-server/6.0

Proposed by Anup(SerpentCS)
Status: Rejected
Rejected by: Olivier Dony (Odoo)
Proposed branch: lp:~openerp-dev/openobject-server/6.0-opw-6168-ach
Merge into: lp:openobject-server/6.0
Diff against target: 38 lines (+9/-1)
2 files modified
bin/service/web_services.py (+4/-1)
bin/tools/misc.py (+5/-0)
To merge this branch: bzr merge lp:~openerp-dev/openobject-server/6.0-opw-6168-ach
Reviewer Review Type Date Requested Status
Olivier Dony (Odoo) Disapprove
Naresh(OpenERP) Pending
Jay Vora (Serpent Consulting Services) Pending
Review via email: mp+65292@code.launchpad.net

Description of the change

Hello,

   When Postgres server is restarted it is not possible to connect to the same db which was connected when the server was restarted. Even if the user disconnects.

   I have found a fix for such situation.

Thanks.

To post a comment you must log in.
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Sorry, this does not seem like a valid approach.

Firstly, we should not rely on anything coming from the client side to solve a server-side issue, as OpenERP is supposed to be stateless.
Secondly, calling exposing a way to close_db has major and global effects on the server, impacting all current transactions on that database, so this certainly cannot be called as soon as someone logs out.

Managing database connections is the responsibility of the server, it must not be exposed to clients, or for that matter, to addons.

review: Disapprove
Revision history for this message
xrg (xrg) wrote :

On Tuesday 21 June 2011, you wrote:

> When Postgres server is restarted it is not possible to connect to the
> same db which was connected when the server was restarted. Even if the
> user disconnects.
>
> I have found a fix for such situation.

I agree with Odo.

Allowing a remote close of all pg connections *without authentication* is a
straight remote DoS . Unacceptable.

Otoh, in pg84 branch, this problem had been fixed long ago.

--
Say NO to spam and viruses. Stop using Microsoft Windows!

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/service/web_services.py'
2--- bin/service/web_services.py 2011-01-15 17:04:10 +0000
3+++ bin/service/web_services.py 2011-06-21 05:24:32 +0000
4@@ -385,7 +385,7 @@
5 return True
6 elif method in ['about', 'timezone_get', 'get_server_environment',
7 'login_message','get_stats', 'check_connectivity',
8- 'list_http_services']:
9+ 'list_http_services','logout_db']:
10 pass
11 elif method in ['get_available_updates', 'get_migration_scripts', 'set_loglevel', 'get_os_time', 'get_sqlcount']:
12 passwd = params[0]
13@@ -440,6 +440,9 @@
14 def exp_timezone_get(self, db, login, password):
15 return tools.misc.get_server_timezone()
16
17+ def exp_logout_db(self, db, login, password):
18+ return tools.misc.logout_db(db)
19+
20 def exp_get_available_updates(self, contract_id, contract_password):
21 import tools.maintenance as tm
22 try:
23
24=== modified file 'bin/tools/misc.py'
25--- bin/tools/misc.py 2011-01-20 12:40:20 +0000
26+++ bin/tools/misc.py 2011-06-21 05:24:32 +0000
27@@ -1264,6 +1264,11 @@
28 ip_addr = 'localhost'
29 return ip_addr
30
31+def logout_db(db_name):
32+ from sql_db import close_db
33+ close_db(db_name)
34+ return True
35+
36 # RATIONALE BEHIND TIMESTAMP CALCULATIONS AND TIMEZONE MANAGEMENT:
37 # The server side never does any timestamp calculation, always
38 # sends them in a naive (timezone agnostic) format supposed to be