{"action":"created","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/4443","repository_url":"https://api.github.com/repos/laravel/framework","labels_url":"https://api.github.com/repos/laravel/framework/issues/4443/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/4443/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/4443/events","html_url":"https://github.com/laravel/framework/issues/4443","id":33807422,"number":4443,"title":"supervised queue:listen stops working","user":{"login":"schickling","id":1567498,"avatar_url":"https://avatars.githubusercontent.com/u/1567498?v=3","gravatar_id":"","url":"https://api.github.com/users/schickling","html_url":"https://github.com/schickling","followers_url":"https://api.github.com/users/schickling/followers","following_url":"https://api.github.com/users/schickling/following{/other_user}","gists_url":"https://api.github.com/users/schickling/gists{/gist_id}","starred_url":"https://api.github.com/users/schickling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schickling/subscriptions","organizations_url":"https://api.github.com/users/schickling/orgs","repos_url":"https://api.github.com/users/schickling/repos","events_url":"https://api.github.com/users/schickling/events{/privacy}","received_events_url":"https://api.github.com/users/schickling/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2014-05-19T15:00:33Z","updated_at":"2016-04-27T13:47:41Z","closed_at":"2014-05-19T22:00:40Z","body":"I'm running the queue listen process via the following supervisor config (I'm using SQS).\r\n\r\n```\r\n[program:laravel-queue]\r\ncommand=/usr/bin/php /var/www/server/current/artisan queue:listen --timeout 300 --tries=5 --env=\"production\"\r\nusername=www-data\r\nautostart=true\r\nautorestart=true\r\nstdout_logfile=/var/log/%(program_name)s.stdout\r\nstderr_logfile=/var/log/%(program_name)s.stderr\r\n```\r\n\r\nSometimes (~ every 5th day) the listen process \"stops\" and doesn't consume any further tasks in the queue. The process doesn't exit and thus won't be restarted via supervisor. The stdout/stderr logfiles are empty.\r\n\r\nWhen I restart the queue listen process via `supervisorctl restart` all queued up processes get worked off.\r\n\r\nIs there a best practice to monitor this behavior correctly until this issue gets resolved?\r\nI've written a little package to check for me if the queue is jammed, but it feels not very clean: https://github.com/schickling/laravel-queue-checker"},"comment":{"url":"https://api.github.com/repos/laravel/framework/issues/comments/215088771","html_url":"https://github.com/laravel/framework/issues/4443#issuecomment-215088771","issue_url":"https://api.github.com/repos/laravel/framework/issues/4443","id":215088771,"user":{"login":"matejvelikonja","id":1881087,"avatar_url":"https://avatars.githubusercontent.com/u/1881087?v=3","gravatar_id":"","url":"https://api.github.com/users/matejvelikonja","html_url":"https://github.com/matejvelikonja","followers_url":"https://api.github.com/users/matejvelikonja/followers","following_url":"https://api.github.com/users/matejvelikonja/following{/other_user}","gists_url":"https://api.github.com/users/matejvelikonja/gists{/gist_id}","starred_url":"https://api.github.com/users/matejvelikonja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matejvelikonja/subscriptions","organizations_url":"https://api.github.com/users/matejvelikonja/orgs","repos_url":"https://api.github.com/users/matejvelikonja/repos","events_url":"https://api.github.com/users/matejvelikonja/events{/privacy}","received_events_url":"https://api.github.com/users/matejvelikonja/received_events","type":"User","site_admin":false},"created_at":"2016-04-27T13:47:41Z","updated_at":"2016-04-27T13:47:41Z","body":"A, ok. I see which part you do not understand.\r\n\r\nSo, the Laravel workers work like this:\r\n- they check if there are jobs in the queue\r\n- **first they check all the reserved jobs and check if any of them were reserved for more than `expire` property that you have in your config file. if there are expired jobs, they release them. they do no check if some other worker died or it's just processing for so long.**\r\n- they select the job and reserved it\r\n- they start processing their reserved job\r\n- they release it (or they die trying)\r\n\r\n\r\nThe bolded text is the most important part, in that step the worker can select an already processing job, if it's processing for to long, and they think that the first worker died and it just forget to release it. So the easy fix is to set `expire` to a bit more, like an hour or so.\r\n\r\nThe second, better approach is the solution that I describe in previous comment.\r\n\r\nI hope I made it a bit more clear for you now."}}