Skip to content

[FIX] Request id no longer exists after concurrency rollback#701

Merged
lasley merged 1 commit into
OCA:8.0from
StefanRijnhart:8.0-auditlog_concurrency_rollback
Feb 21, 2017
Merged

[FIX] Request id no longer exists after concurrency rollback#701
lasley merged 1 commit into
OCA:8.0from
StefanRijnhart:8.0-auditlog_concurrency_rollback

Conversation

@StefanRijnhart

Copy link
Copy Markdown
Member

The request id stored on the http request can be rolled back when a concurrency error occurs. Upon retry, the id does not exist anymore.

Related logs look like this:

Traceback (most recent call last):
  File "/opt/odoo/parts/odoo/openerp/sql_db.py", line 234, in execute
    res = self._obj.execute(query, params)
TransactionRollbackError: could not serialize access due to concurrent update
2017-01-16 05:31:59,837 25491 INFO odoo [-][-][-] openerp.service.model: SERIALIZATION_FAILURE, retry 1/5 in 0.3513 sec...
[...]
IntegrityError: insert or update on table "auditlog_log" violates foreign key constraint "auditlog_log_http_request_id_fkey"
DETAIL:  Key (http_request_id)=(2263) is not present in table "auditlog_http_request".

@StefanRijnhart StefanRijnhart added this to the 8.0 milestone Jan 16, 2017

@sebalix sebalix left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor change, otherwise 👍

# © 2015 ABF OSIELL <http://osiell.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from psycopg2.extensions import AsIs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One line space between third modules and Odoo imports?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm, this is not linted and it's not even in the guidelines. https://github.com/OCA/maintainer-tools/blob/master/CONTRIBUTING.md#imports only explicitely mentions the order of the imports, even if it uses newlines to clarify the grouping in the example. Seems like a cornercase to me, no?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is, that's why I am not blocking the PR ;) I'm used to do this to clarify the Python dependencies (like the example you linked), and it must be difficult for a quality checker to guess that I think.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the guidelines recommend us run isort
This lint detect this case and auto-fix.
But it is optional.
If you don't want is goos to us

@moylop260 moylop260 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
I didn't know AsIs method to avoid sql injection from table section
Thanks!

@sebalix

sebalix commented Jan 23, 2017

Copy link
Copy Markdown
Contributor

@StefanRijnhart Do you think this error could occurred on 10.0? To know if there is an interest to include it in #707

@StefanRijnhart

Copy link
Copy Markdown
Member Author

I would be surprised if it did not occur in 10.0, so please have it included there.

@sebalix

sebalix commented Feb 3, 2017

Copy link
Copy Markdown
Contributor

Two approvals, is someone available to merge this PR please ? ;)

@lasley
lasley merged commit aca89e2 into OCA:8.0 Feb 21, 2017
SiesslPhillip pushed a commit to grueneerde/OCA-server-tools that referenced this pull request Nov 20, 2024
Syncing from upstream OCA/server-tools (10.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants