[trunk][7.0] Backup Database - `Access Denied` error even with right db-management password

Bug #1155523 reported by Ignazio GAnci
28
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Fix Released
High
OpenERP's Framework R&D

Bug Description

Hi
when i try to backup the DB i have the message "ACCESS DENIED" ad screenshoot attached. I'm sure the main password is right... to test this i've tryed to change the main password and the change is confirmed.

Changed in openobject-server:
assignee: nobody → OpenERP's Framework R&D (openerp-dev-framework)
importance: Undecided → High
status: New → Confirmed
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

I can't reproduce the problem, either with password-based authentication or with unix socket authentication. The screenshot mentioned in the bug report was not attached.

Jignesh, if you confirmed it's because you managed to reproduce it, right? Could you please provide clear steps to reproduce (including the configuration file and postgres config if relevant)? Thanks a lot!

Changed in openobject-server:
importance: High → Medium
status: Confirmed → Incomplete
Revision history for this message
Michael Meierhoff (michael-meierhoff) wrote :

I can reproduse this error on Mac Enviroment:
...
  File "/Users/mime/Development/workspace/openerp.trunk/server/openerp/service/wsgi_server.py", line 475, in close_socket
    if e.errno != errno.ENOTCONN or platform.system() not in ['Darwin', 'Windows']:
NameError: global name 'platform' is not defined
...

If i add
<code>
import os
import base64
</code>
to "server/openerp/service/db.py", the problem is solved.

Revision history for this message
Mike C. (miguelmclara-c) wrote :

I have the same problem, I can even change the password, but I can not backup the database!

In the log I see: Exception: Couldn't find pg_dump

However my config is pointed to the correct pg_path and pg_dump exe is defiantly in the bin folder!

Revision history for this message
Jignesh Rathod(OpenERP) (jir-openerp) wrote :

Hello ,

I have face this problem with latest trunk.
I agree with Michael ( Need to import os,base64) Before use it.

Traceback (most recent call last):
  File "/home/jir/workspace/Test/Workspace/Trun/server/trunk/openerp/netsvc.py", line 236, in dispatch_rpc
    result = dispatch(method, params)
  File "/home/jir/workspace/Test/Workspace/Trun/server/trunk/openerp/service/db.py", line 77, in dispatch
    return fn(*params)
  File "/home/jir/workspace/Test/Workspace/Trun/server/trunk/openerp/service/db.py", line 216, in exp_dump
    with _set_pg_password_in_environment():
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/home/jir/workspace/Test/Workspace/Trun/server/trunk/openerp/service/db.py", line 205, in _set_pg_password_in_environment
    if os.name != 'nt' or os.environ.get('PGPASSWORD'):
NameError: global name 'os' is not defined

With Revision :

web = 3702
addons = 8630
server = 4826

THANKS.

Changed in openobject-server:
status: Incomplete → Confirmed
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

@Michael Meierhoff: the issue you mention on OSX with the missing "import platform" has already been fixed in trunk, at revision 4822 revid:<email address hidden>

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Thanks for the replies, but the bug title explicitly mentions OpenERP 7, so I would have like to know on which version the bug reporter (Ignazio GAnci) has reproduced the problem. As he did not reply, I'll assume he was actually using trunk, since there is no issue that can be reproduced in 7.0.

summary: - OpenERP 7 - Backup ACCESS DB DENIED
+ [trunk] Backup Database - ACCESS DB DENIED
Revision history for this message
Ignazio GAnci (ignazio-ganci) wrote : Re: [trunk] Backup Database - ACCESS DB DENIED

Hi
sorry for late reply... how can i check the version? Our technician is out of office today and i don't know how i can check

Revision history for this message
Michael Meierhoff (michael-meierhoff) wrote :

Hi Ignazio,

you can check the version with the command "bzr revno" in the server directory.

Revision history for this message
Ignazio GAnci (ignazio-ganci) wrote :

Thanks
the version is 4898

Revision history for this message
Michael Meierhoff (michael-meierhoff) wrote :

Oliver i can't confirm the fix for OSX.

The fix was make in "openerp/service/wsgi_server.py" but the problem is in "server/openerp/service/db.py"

If i add there following code snip set:
<code>
import os
import base64
</code>
 the problem is solved.

My version of the server brunch is 4826 and the error message is:
<code>
2013-03-18 10:28:44,062 22468 ERROR None openerp.netsvc: global name 'os' is not defined
Traceback (most recent call last):
  File "/Users/mime/Development/workspace/openerp.trunk/server/openerp/netsvc.py", line 236, in dispatch_rpc
    result = dispatch(method, params)
  File "/Users/mime/Development/workspace/openerp.trunk/server/openerp/service/db.py", line 77, in dispatch
    return fn(*params)
  File "/Users/mime/Development/workspace/openerp.trunk/server/openerp/service/db.py", line 216, in exp_dump
    with _set_pg_password_in_environment():
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/Users/mime/Development/workspace/openerp.trunk/server/openerp/service/db.py", line 205, in _set_pg_password_in_environment
    if os.name != 'nt' or os.environ.get('PGPASSWORD'):
NameError: global name 'os' is not defined
</code>

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote : Re: [Bug 1155523] Re: [trunk] Backup Database - ACCESS DB DENIED

On 03/18/2013 11:22 AM, Ignazio GAnci wrote:
> the version is 4898

4898 looks like the latest revision of the 7.0 server, as of right now. I can't
reproduce this error with it, so it would be great if you could provide more
information:

- Could you post a screenshot with the error?

- Do you have access to the server log files? Seeing the contents of the log at
the time when the error occurs would be *really* useful.

- A copy of the configuration file used to start OpenERP could be useful too,
but be sure to change all the sensitive information (passwords mostly)

Thanks!

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote : Re: [Bug 1155523] Re: [trunk] Backup Database - ACCESS DB DENIED

On 03/18/2013 11:36 AM, Michael Meierhoff wrote:
> Oliver i can't confirm the fix for OSX.

I was referring to the error you quoted in comment #2:
   "NameError: global name 'platform' is not defined"
This one was in wsgi_server.py and has been solved at rev. 4822 in *trunk*.

The other issue in db.py has now been fixed at revision 4828 in *trunk*
(revision-id: <email address hidden>)

I'll mark the issue as fixed, but I will be glad to reopen it at any time once
Ignazio provides more information on the specific 7.0 problem (be careful, the
trunk revision numbers are not the same as the 7.0 ones!)

Thanks everyone for your feedback!

PS: These basic errors should never happen on a stable version, but some of you
are using the `trunk` series of OpenERP, which is not suited for production. It
may undergo deep changes and refactoring that may cause it to be rather
unstable at times. The various branches of OpenERP are described in the release
policy: http://v6.openerp.com/release-policy

Changed in openobject-server:
importance: Medium → High
status: Confirmed → Fix Released
Revision history for this message
Ignazio GAnci (ignazio-ganci) wrote : Re: [trunk] Backup Database - ACCESS DB DENIED

Attached the screenshot.

I have accesso to the server log files but i don't know how to export file and which file do you need...if you tell me i can send immediatly or i have to wait our technician and he will do it
thanks

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

On 03/18/2013 12:15 PM, Ignazio GAnci wrote:
> Attached the screenshot.

Thanks, it confirms there is an issue but does not help in finding the cause.

> I have accesso to the server log files but i don't know how to export file
> and which file do you need...if you tell me i can send immediatly or i have
> to wait our technician and he will do it thanks

There should be an openerp-server.log files or something similar. This should
be a text file in which all lines are prefixed with a timestamp, like:
  2013-03-18 12:31:16,886 27251 INFO ? openerp: OpenERP version 7.0
  2013-03-18 12:31:16,886 27251 INFO ? openerp: database hostname: localhost

This file changes all the time, and it would be great if you could copy/paste
here all the lines that appear at the bottom of the file right after your
attempt to backup the database. The timestamps should help you locate the
correct lines, but watch out that they are in UTC timezone. We're looking for
one or more error messages along with one line like the following:

2013-03-18 13:00:05,504 28241 INFO None werkzeug: 127.0.0.1 - - [18/Mar/2013
13:00:05] "GET /web/database/backup?...... HTTP/1.1" 200

Thanks!

Revision history for this message
Brendan Clune (Logic Supply) (brendan-clune) wrote : Re: [trunk] Backup Database - ACCESS DB DENIED

Is it related to this?

https://bugs.launchpad.net/openobject-server/+bug/1124440

In 7.0, connecting over TCP to a local database no longer sets the PGPASSWORD environment variable on non-Windows machines.

Revision history for this message
Michael Meierhoff (michael-meierhoff) wrote :

I can reproduce also a bug on version 4898 in branch 7.0. On OSX in my case

<log>
2013-03-18 13:32:43,914 49226 ERROR ? openerp.netsvc: must be string, not bool
Traceback (most recent call last):
  File "/Users/mime/Development/workspace/openerp.70/server/openerp/netsvc.py", line 293, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/Users/mime/Development/workspace/openerp.70/server/openerp/service/web_services.py", line 122, in dispatch
    return fn(*params)
  File "/Users/mime/Development/workspace/openerp.70/server/openerp/service/web_services.py", line 264, in exp_dump
    with self._set_pg_password_in_environment():
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/Users/mime/Development/workspace/openerp.70/server/openerp/service/web_services.py", line 255, in _set_pg_password_in_environment
    os.environ['PGPASSWORD'] = tools.config['db_password']
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 471, in __setitem__
    putenv(key, item)
TypeError: must be string, not bool
</log>

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote : Re: [Bug 1155523] Re: [trunk] Backup Database - ACCESS DB DENIED

On 03/18/2013 02:51 PM, Michael Meierhoff wrote:
> I can reproduce also a bug on version 4898 in branch 7.0. On OSX in my
> case
(SNIP)
> TypeError: must be string, not bool

Thanks Michael, I suspect this is the same error that Ignazio is having, and
can only be triggered on Linux or OSX when connecting to PostgreSQL using a
`unix-domain socket` rather than a TCP connection.

This is now fixed at server revision 4899[1] in the 7.0 branch. All the various
types of connections should work reasonably well on all platform now - as long
as OpenERP itself is properly configured to connect to PostgreSQL.

Thanks for your patience!

[1] revision-id: <email address hidden>

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

On 03/18/2013 02:18 PM, Brendan Clune (Logic Supply) wrote:
> Is it related to this?
>
> https://bugs.launchpad.net/openobject-server/+bug/1124440

Yes it is definitely related, but the issue described in bug 1124440 was
already fixed at rev. 4893 in 7.0 server. I'll provide more info on bug 1124440.

summary: - [trunk] Backup Database - ACCESS DB DENIED
+ [trunk][7.0] Backup Database - `Access Denied` error even with right db-
+ management password
Changed in openobject-server:
milestone: none → 7.0
Revision history for this message
Michael Meierhoff (michael-meierhoff) wrote :

Thank you very much Oliver. Great work, now all work like suspect.

Revision history for this message
Ignazio GAnci (ignazio-ganci) wrote :

Thanks all! Now it works!

Revision history for this message
Mike C. (miguelmclara-c) wrote :

I get the same "access denied" problem in Windows, i posted in: https://bugs.launchpad.net/openobject-server/+bug/1124440

but I'm sure if that was the right place!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.