{"action":"closed","issue":{"url":"https://api.github.com/repos/OCA/connector/issues/148","labels_url":"https://api.github.com/repos/OCA/connector/issues/148/labels{/name}","comments_url":"https://api.github.com/repos/OCA/connector/issues/148/comments","events_url":"https://api.github.com/repos/OCA/connector/issues/148/events","html_url":"https://github.com/OCA/connector/issues/148","id":117543073,"number":148,"title":"Job stuck in 'enqueued'","user":{"login":"guewen","id":417223,"avatar_url":"https://avatars.githubusercontent.com/u/417223?v=3","gravatar_id":"","url":"https://api.github.com/users/guewen","html_url":"https://github.com/guewen","followers_url":"https://api.github.com/users/guewen/followers","following_url":"https://api.github.com/users/guewen/following{/other_user}","gists_url":"https://api.github.com/users/guewen/gists{/gist_id}","starred_url":"https://api.github.com/users/guewen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guewen/subscriptions","organizations_url":"https://api.github.com/users/guewen/orgs","repos_url":"https://api.github.com/users/guewen/repos","events_url":"https://api.github.com/users/guewen/events{/privacy}","received_events_url":"https://api.github.com/users/guewen/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-11-18T09:07:37Z","updated_at":"2016-01-04T08:23:19Z","closed_at":"2016-01-04T08:23:19Z","body":"We had this case today with the jobrunner (version 7.0).\r\n\r\nA job was stuck in `enqueued`, blocking the queue because it took a place, considered as a running job.\r\n\r\nOur analysis was that the jobrunner updated the state of the job to enqueued, but the `GET` call to run the job on the Odoo workers had never reached Odoo (no trace of `GET` for this job in the logs). The reason why the `GET` call was not done is unknown (other jobs were correctly processed just before).\r\n\r\nIn the runner's logs, we have:\r\n```\r\n\r\n2015-11-17 18:25:27,873 9168 INFO ? openerp.addons.connector.jobrunner.runner: asking Odoo to run job a9e5d41a-433f-43e5-b584-e6991cf2a64e on db openerp_prod_xxx\r\n2015-11-17 18:25:27,876 9168 INFO ? requests.packages.urllib3.connectionpool: Starting new HTTP connection (1): localhost\r\n```\r\n\r\nSo we expect to have this in the Odoo logs:\r\n```\r\n2015-11-17 18:25:27,876 5327 INFO openerp_prod_xxx werkzeug: 127.0.0.1 - - [17/Nov/2015 18:25:27] \"GET /connector/runjob?db=openerp_prod_xxx&job_uuid=a9e5d41a-433f-43e5-b584-e6991cf2a64e HTTP/1.1\" 200 -\r\n```\r\n\r\nBut there is nothing.\r\n\r\nIn a general manner, if anything goes wrong when we call `_async_http_get` (https://github.com/OCA/connector/blob/9.0/connector/jobrunner/runner.py#L134-L149) (which is very rare but could happen), a job will stay stuck in `enqueued` state.\r\n\r\nA possible workaround would be to add a cron that check if a job is enqueued for too long and requeue it. But I wonder if we couldn't find a nicer way to fix it (what about removing the `enqueued` state? side-effects?)\r\n\r\n@sbidoul @lmignon  you surely have ideas :-)"}}