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

[10.0]Could not acquire advisory lock #55

Closed
flotho opened this issue Feb 9, 2018 · 3 comments
Closed

[10.0]Could not acquire advisory lock #55

flotho opened this issue Feb 9, 2018 · 3 comments

Comments

@flotho
Copy link
Member

flotho commented Feb 9, 2018

Hi,
I'm running odoo connector and working on this PR : OCA/connector-odoo2odoo#7

My job working correctly except 2 jobs that are always restated as pending the started with this message :

Could not acquire advisory lock

In the logs I can see those kind of messages :

e_job/runjob?db=crma_occitanie&job_uuid=be1b053c-23b1-4c6f-9551-0a0c1fbe6c11 HTTP/1.1" 200 -
2018-02-09 13:58:21,185 24579 DEBUG crma_occitanie odoo.addons.connector_odoo.components.backend_adapter: <traceback object at 0x7fc6bdb0a488>
2018-02-09 13:58:21,194 24579 DEBUG crma_occitanie odoo.addons.queue_job.controllers.main: <Job 022ac139-86f9-492f-ab04-7b2d145069e2, priority:10> postponed
2018-02-09 13:58:21,195 24552 WARNING ? odoo.addons.queue_job.jobrunner.channels: unknown channel root.odoo, using root channel for job 022ac139-86f9-492f-ab04-7b2d145069e2
2018-02-09 13:58:21,195 24552 DEBUG ? odoo.addons.queue_job.jobrunner.channels: job 022ac139-86f9-492f-ab04-7b2d145069e2 properties changed, rescheduling it
2018-02-09 13:58:21,196 24552 DEBUG ? odoo.addons.queue_job.jobrunner.channels: job 022ac139-86f9-492f-ab04-7b2d145069e2 marked pending in channel root(C:3,Q:2,R:0,F:0)
2018-02-09 13:58:21,196 24552 DEBUG ? odoo.addons.queue_job.jobrunner.runner: select() timeout: 0.80 sec

Any advice would be appreciated

@guewen
Copy link
Member

guewen commented Feb 9, 2018

The interesting line is
odoo.addons.connector_odoo.components.backend_adapter: <traceback object at 0x7fc6bdb0a488>
The next line indicates that the job has been postponed, because of the error. The error being probably this Could not acquire advisory lock.

The WARNING line indicates that the job has been set on a channel root.odoo, but this channel has not been configured at the startup of the queue job runner. It will just execute it in in the root channel.

The last 3 lines are normal operations of the jobrunner.

Back to the advisory lock:

First you may want to show the full traceback in your logs, because <traceback object at 0x7fc6bdb0a488> is not very informative :)

The exporter tries to acquires the advisory lock here:
https://github.com/OCA/connector-odoo2odoo/pull/7/files#diff-490b3ec0560bd042a97411edb4d1e534R204

If it can't acquires it, it's probably because it has already been acquired by another transaction (but you may find another reason I guess). The purpose of this lock is to prevent 2 jobs to import the same record at the same time. The lock is set on a hash composed from attributes that define the uniqueness of a job (https://github.com/OCA/connector-odoo2odoo/pull/7/files#diff-490b3ec0560bd042a97411edb4d1e534R180). Are you sure the values you use here are unique?

Also, check if you don't have a staled transaction in postgres which would have kept the lock.

I don't see any issue in the queue, it's either in your setup, either in your implementation.

I find it weird that the exception is logged by odoo.addons.connector_odoo.components.backend_adapter, you should try to display the traceback.

@guewen guewen closed this as completed Feb 9, 2018
@flotho
Copy link
Member Author

flotho commented Feb 9, 2018

Thanks @guewen , I'll gonna give feedback on this

@flotho
Copy link
Member Author

flotho commented Feb 10, 2018

Thanks @guewen you're right, a constraint was missing and I had duplicates in bindings !

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

No branches or pull requests

2 participants