Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[12.0][FIX] base: postgres subprocess error when dumping database #1211

Open
wants to merge 1 commit into
base: 12.0
Choose a base branch
from

Conversation

igallart
Copy link
Member

@igallart igallart commented Nov 25, 2023

When Odoo is installed with the latest version of the PostgreSQL client (postgres-client or postgres-client-16) and running in Docker (possibly other environments as well but not reproduced so far), executing pg_dump via exec_pg_command fails with

Database backup error: Postgres subprocess ('/usr/bin/pg_dump', '--no-owner', '--file=/tmp/tmpmnqiktog/dump.sql', '15TEST') error 1

This seems to be because os.devnull is being opened in read mode which is incorrect (as it's written to). It's not entirely clear if older pg_dump simply ignored the non-writable stdout or if docker adds some restrictions which cause the failure.

Either way this can be solved by either opening os.devnull in write mode or switching to the DEVNULL constant. While the function is deprecated in 16.0 (7f14631) and removed in master (ae3056f) the latter is not a huge change and it a touch cleaner.

fixes odoo#139687

closes odoo#143198

When Odoo is installed with the latest version of the PostgreSQL client (postgres-client or postgres-client-16) and running in Docker (possibly other environments as well but not reproduced so far), executing `pg_dump` via `exec_pg_command` fails with

    Database backup error: Postgres subprocess ('/usr/bin/pg_dump', '--no-owner', '--file=/tmp/tmpmnqiktog/dump.sql', '15TEST') error 1

This seems to be because `os.devnull` is being opened in *read* mode which is incorrect (as it's written to). It's not entirely clear if older `pg_dump` simply ignored the non-writable stdout or if docker adds some restrictions which cause the failure.

Either way this can be solved by either opening `os.devnull` in write mode or switching to the `DEVNULL` constant. While the function is deprecated in 16.0 (7f14631) and removed in master (ae3056f) the latter is not a huge change and it a touch cleaner.

fixes odoo#139687

closes odoo#143198

Forward-port-of: odoo#142987
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants