{"issue":{"title":"Multiple Workers = Lost jobs?","user":{"login":"RVN-BR","id":1218902,"url":"https://api.github.com/users/RVN-BR","avatar_url":"https://secure.gravatar.com/avatar/e33af81d39f14364d23b04a622ce8594?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"e33af81d39f14364d23b04a622ce8594"},"created_at":"2011-12-22T03:17:30Z","milestone":null,"labels":[],"state":"open","updated_at":"2011-12-26T20:09:06Z","id":2632703,"closed_at":null,"html_url":"https://github.com/chrisboulton/php-resque/issues/32","pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"body":"As per a comment on issue #30, I'm opening this issue in order to help gather more info and find a fix for the bug.\r\n\r\nI observed that when deploying multiple workers, some jobs dont get processed...\r\n\r\nBasically the test I did was:\r\n\r\nwatch output and number of jobs, launch 5 workers.\r\nEnqueue 10 jobs.  number of jobs in redis gets augmented to 10 (so 10 jobs queued), but only a few get really processed.  Nonetheless, they all get pulled out of the queue...\r\n\r\nSo basically it is \"loosing\" jobs.\r\n\r\nI will try and test more tomorrow, time permitting, and post back.\r\n\r\nChris said he had already noticed this, so if anyone else has noticed and/or fixed this, please let us know.\r\n\r\nImo this is crucial for any production environment, no?  Is anyone using phpresque in a production environment? Are you loosing jobs? Maybe you havent noticed?  Can you please check and revert?  \r\n\r\nthanks!","number":32,"url":"https://api.github.com/repos/chrisboulton/php-resque/issues/32","comments":13,"assignee":null},"comment":{"user":{"login":"RVN-BR","id":1218902,"url":"https://api.github.com/users/RVN-BR","avatar_url":"https://secure.gravatar.com/avatar/e33af81d39f14364d23b04a622ce8594?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"e33af81d39f14364d23b04a622ce8594"},"created_at":"2011-12-26T20:09:05Z","updated_at":"2011-12-26T20:09:05Z","id":3276612,"body":"OK, here is some debug from running a monitor command on the redis server...\r\n\r\nAfter starting the monitor session I enqued 5 jobs, and let the 3 worker worker pool get at it...\r\n\r\nas you can see, 4 of the 5 jobs got processed, one got lost... I didnt analyze it yet as I'm a bit late right now, if anyone wants a crack at it here it is:\r\n\r\nJobs:\r\n[root@NaWebTeste demo]# php queue.php JB 1\r\nQueued job 1f79c41a8264e53eda3a65637896b490\r\n\r\n[root@NaWebTeste demo]# php queue.php JB 1\r\nQueued job 7b293cb9a1364e25751ef06161863dce\r\n\r\n[root@NaWebTeste demo]# php queue.php JB 12\r\nQueued job a4ce5675c552f77b7acf10f6909666fa\r\n\r\n[root@NaWebTeste demo]# php queue.php JB 123\r\nQueued job 120a48dd26c2a1a7c4583940e257924a\r\n\r\n[root@NaWebTeste demo]# php queue.php JB 1234\r\nQueued job f3d2ba4584fb92d3ad2a1ff91c9e54bf\r\n\r\n[root@NaWebTeste demo]# php queue.php JB 12345\r\nQueued job 8f219e57f28c812da0480cb2109cc70e\r\n\r\nThe last one, Job ID 8f219e57f28c812da0480cb2109cc70e is the one that got lost, so basically need to find the difference in this one and the rest...\r\n´´´\r\n+1324929851.670237 \"RPUSH\" \"resque:queue:default\" \"{\\\"class\\\":\\\"JB\\\",\\\"args\\\":[{\\\"time\\\":1324929851,\\\"array\\\":{\\\"test\\\":\\\"test1\\\"}}],\\\"id\\\":\\\"1f79c41a8264e53eda3a65637896b490\\\"}\"\r\n+1324929851.670452 \"SET\" \"resque:job:1f79c41a8264e53eda3a65637896b490:status\" \"{\\\"status\\\":1,\\\"updated\\\":1324929851,\\\"started\\\":1324929851}\"\r\n+1324929855.252069 \"LPOP\" \"resque:queue:default\"\r\n+1324929855.252242 \"LPOP\" \"resque:queue:default\"\r\n+1324929855.252500 \"EXISTS\" \"resque:job:6c3336791a0a09a9347db644ead28a19:status\"\r\n+1324929855.252631 \"SET\" \"resque:job:6c3336791a0a09a9347db644ead28a19:status\" \"{\\\"status\\\":2,\\\"updated\\\":1324929855}\"\r\n+1324929855.252894 \"SET\" \"resque:worker:NaWebTeste:12377:default\" \"{\\\"queue\\\":\\\"default\\\",\\\"run_at\\\":\\\"Mon Dec 26 18:04:15 BRST 2011\\\",\\\"payload\\\":{\\\"class\\\":\\\"JB\\\",\\\"args\\\":[{\\\"time\\\":1324929851,\\\"array\\\":{\\\"test\\\":\\\"test1\\\"}}],\\\"id\\\":\\\"6c3336791a0a09a9347db644ead28a19\\\"}}\"\r\n+1324929855.254880 \"EXISTS\" \"resque:job:6c3336791a0a09a9347db644ead28a19:status\"\r\n+1324929855.255188 \"SET\" \"resque:job:6c3336791a0a09a9347db644ead28a19:status\" \"{\\\"status\\\":4,\\\"updated\\\":1324929855}\"\r\n+1324929855.255424 \"EXPIRE\" \"resque:job:6c3336791a0a09a9347db644ead28a19:status\" \"86400\"\r\n+1324929855.261413 \"LPOP\" \"resque:queue:default\"\r\n+1324929855.264997 \"INCRBY\" \"resque:stat:processed\" \"1\"\r\n+1324929855.265245 \"INCRBY\" \"resque:stat:processed:NaWebTeste:12377:default\" \"1\"\r\n+1324929855.265434 \"DEL\" \"resque:worker:NaWebTeste:12377:default\"\r\n+1324929855.265637 \"LPOP\" \"resque:queue:default\"\r\n+1324929857.970754 \"SELECT\" \"0\"\r\n+1324929857.971603 \"SADD\" \"resque:queues\" \"default\"\r\n+1324929857.971803 \"RPUSH\" \"resque:queue:default\" \"{\\\"class\\\":\\\"JB\\\",\\\"args\\\":[{\\\"time\\\":1324929857,\\\"array\\\":{\\\"test\\\":\\\"test1\\\"}}],\\\"id\\\":\\\"7b293cb9a1364e25751ef06161863dce\\\"}\"\r\n+1324929857.972005 \"SET\" \"resque:job:7b293cb9a1364e25751ef06161863dce:status\" \"{\\\"status\\\":1,\\\"updated\\\":1324929857,\\\"started\\\":1324929857}\"\r\n+1324929858.498800 \"SELECT\" \"0\"\r\n+1324929858.499643 \"SADD\" \"resque:queues\" \"default\"\r\n+1324929858.499829 \"RPUSH\" \"resque:queue:default\" \"{\\\"class\\\":\\\"JB\\\",\\\"args\\\":[{\\\"time\\\":1324929858,\\\"array\\\":{\\\"test\\\":\\\"test12\\\"}}],\\\"id\\\":\\\"a4ce5675c552f77b7acf10f6909666fa\\\"}\"\r\n+1324929858.500033 \"SET\" \"resque:job:a4ce5675c552f77b7acf10f6909666fa:status\" \"{\\\"status\\\":1,\\\"updated\\\":1324929858,\\\"started\\\":1324929858}\"\r\n+1324929859.187083 \"SELECT\" \"0\"\r\n+1324929859.187872 \"SADD\" \"resque:queues\" \"default\"\r\n+1324929859.188046 \"RPUSH\" \"resque:queue:default\" \"{\\\"class\\\":\\\"JB\\\",\\\"args\\\":[{\\\"time\\\":1324929859,\\\"array\\\":{\\\"test\\\":\\\"test123\\\"}}],\\\"id\\\":\\\"120a48dd26c2a1a7c4583940e257924a\\\"}\"\r\n+1324929859.188318 \"SET\" \"resque:job:120a48dd26c2a1a7c4583940e257924a:status\" \"{\\\"status\\\":1,\\\"updated\\\":1324929859,\\\"started\\\":1324929859}\"\r\n+1324929859.716311 \"SELECT\" \"0\"\r\n+1324929859.717144 \"SADD\" \"resque:queues\" \"default\"\r\n+1324929859.717355 \"RPUSH\" \"resque:queue:default\" \"{\\\"class\\\":\\\"JB\\\",\\\"args\\\":[{\\\"time\\\":1324929859,\\\"array\\\":{\\\"test\\\":\\\"test1234\\\"}}],\\\"id\\\":\\\"f3d2ba4584fb92d3ad2a1ff91c9e54bf\\\"}\"\r\n+1324929859.717574 \"SET\" \"resque:job:f3d2ba4584fb92d3ad2a1ff91c9e54bf:status\" \"{\\\"status\\\":1,\\\"updated\\\":1324929859,\\\"started\\\":1324929859}\"\r\n+1324929860.253020 \"LPOP\" \"resque:queue:default\"\r\n+1324929860.253333 \"EXISTS\" \"resque:job:7b293cb9a1364e25751ef06161863dce:status\"\r\n+1324929860.253540 \"SET\" \"resque:job:7b293cb9a1364e25751ef06161863dce:status\" \"{\\\"status\\\":2,\\\"updated\\\":1324929860}\"\r\n+1324929860.253762 \"SET\" \"resque:worker:NaWebTeste:12378:default\" \"{\\\"queue\\\":\\\"default\\\",\\\"run_at\\\":\\\"Mon Dec 26 18:04:20 BRST 2011\\\",\\\"payload\\\":{\\\"class\\\":\\\"JB\\\",\\\"args\\\":[{\\\"time\\\":1324929857,\\\"array\\\":{\\\"test\\\":\\\"test1\\\"}}],\\\"id\\\":\\\"7b293cb9a1364e25751ef06161863dce\\\"}}\"\r\n+1324929860.255602 \"EXISTS\" \"resque:job:7b293cb9a1364e25751ef06161863dce:status\"\r\n+1324929860.255844 \"SET\" \"resque:job:7b293cb9a1364e25751ef06161863dce:status\" \"{\\\"status\\\":4,\\\"updated\\\":1324929860}\"\r\n+1324929860.256021 \"EXPIRE\" \"resque:job:7b293cb9a1364e25751ef06161863dce:status\" \"86400\"\r\n+1324929860.259094 \"SELECT\" \"0\"\r\n+1324929860.259858 \"SADD\" \"resque:queues\" \"default\"\r\n+1324929860.260030 \"RPUSH\" \"resque:queue:default\" \"{\\\"class\\\":\\\"JB\\\",\\\"args\\\":[{\\\"time\\\":1324929860,\\\"array\\\":{\\\"test\\\":\\\"test12345\\\"}}],\\\"id\\\":\\\"8f219e57f28c812da0480cb2109cc70e\\\"}\"\r\n+1324929860.260218 \"SET\" \"resque:job:8f219e57f28c812da0480cb2109cc70e:status\" \"{\\\"status\\\":1,\\\"updated\\\":1324929860,\\\"started\\\":1324929860}\"\r\n+1324929860.261810 \"LPOP\" \"resque:queue:default\"\r\n+1324929860.262087 \"EXISTS\" \"resque:job:a4ce5675c552f77b7acf10f6909666fa:status\"\r\n+1324929860.262315 \"SET\" \"resque:job:a4ce5675c552f77b7acf10f6909666fa:status\" \"{\\\"status\\\":2,\\\"updated\\\":1324929860}\"\r\n+1324929860.262547 \"SET\" \"resque:worker:NaWebTeste:12380:default\" \"{\\\"queue\\\":\\\"default\\\",\\\"run_at\\\":\\\"Mon Dec 26 18:04:20 BRST 2011\\\",\\\"payload\\\":{\\\"class\\\":\\\"JB\\\",\\\"args\\\":[{\\\"time\\\":1324929858,\\\"array\\\":{\\\"test\\\":\\\"test12\\\"}}],\\\"id\\\":\\\"a4ce5675c552f77b7acf10f6909666fa\\\"}}\"\r\n+1324929860.265688 \"EXISTS\" \"resque:job:a4ce5675c552f77b7acf10f6909666fa:status\"\r\n+1324929860.265969 \"LPOP\" \"resque:queue:default\"\r\n+1324929860.266279 \"EXISTS\" \"resque:job:120a48dd26c2a1a7c4583940e257924a:status\"\r\n+1324929860.266423 \"SET\" \"resque:job:a4ce5675c552f77b7acf10f6909666fa:status\" \"{\\\"status\\\":4,\\\"updated\\\":1324929860}\"\r\n+1324929860.266607 \"SET\" \"resque:job:120a48dd26c2a1a7c4583940e257924a:status\" \"{\\\"status\\\":2,\\\"updated\\\":1324929860}\"\r\n+1324929860.266735 \"SET\" \"resque:worker:NaWebTeste:12377:default\" \"{\\\"queue\\\":\\\"default\\\",\\\"run_at\\\":\\\"Mon Dec 26 18:04:20 BRST 2011\\\",\\\"payload\\\":{\\\"class\\\":\\\"JB\\\",\\\"args\\\":[{\\\"time\\\":1324929859,\\\"array\\\":{\\\"test\\\":\\\"test123\\\"}}],\\\"id\\\":\\\"120a48dd26c2a1a7c4583940e257924a\\\"}}\"\r\n+1324929860.267394 \"EXPIRE\" \"resque:job:a4ce5675c552f77b7acf10f6909666fa:status\" \"86400\"\r\n+1324929860.267530 \"INCRBY\" \"resque:stat:processed\" \"1\"\r\n+1324929860.267818 \"INCRBY\" \"resque:stat:processed:NaWebTeste:12378:default\" \"1\"\r\n+1324929860.268003 \"DEL\" \"resque:worker:NaWebTeste:12378:default\"\r\n+1324929860.268239 \"LPOP\" \"resque:queue:default\"\r\n+1324929860.268426 \"EXISTS\" \"resque:job:120a48dd26c2a1a7c4583940e257924a:status\"\r\n+1324929860.268544 \"EXISTS\" \"resque:job:f3d2ba4584fb92d3ad2a1ff91c9e54bf:status\"\r\n+1324929860.268664 \"SET\" \"resque:job:f3d2ba4584fb92d3ad2a1ff91c9e54bf:status\" \"{\\\"status\\\":2,\\\"updated\\\":1324929860}\"\r\n+1324929860.268770 \"SET\" \"resque:worker:NaWebTeste:12378:default\" \"{\\\"queue\\\":\\\"default\\\",\\\"run_at\\\":\\\"Mon Dec 26 18:04:20 BRST 2011\\\",\\\"payload\\\":{\\\"class\\\":\\\"JB\\\",\\\"args\\\":[{\\\"time\\\":1324929859,\\\"array\\\":{\\\"test\\\":\\\"test1234\\\"}}],\\\"id\\\":\\\"f3d2ba4584fb92d3ad2a1ff91c9e54bf\\\"}}\"\r\n+1324929860.269450 \"SET\" \"resque:job:120a48dd26c2a1a7c4583940e257924a:status\" \"{\\\"status\\\":4,\\\"updated\\\":1324929860}\"\r\n+1324929860.269800 \"EXPIRE\" \"resque:job:120a48dd26c2a1a7c4583940e257924a:status\" \"86400\"\r\n+1324929860.270090 \"EXISTS\" \"resque:job:f3d2ba4584fb92d3ad2a1ff91c9e54bf:status\"\r\n+1324929860.270351 \"SET\" \"resque:job:f3d2ba4584fb92d3ad2a1ff91c9e54bf:status\" \"{\\\"status\\\":4,\\\"updated\\\":1324929860}\"\r\n+1324929860.270562 \"EXPIRE\" \"resque:job:f3d2ba4584fb92d3ad2a1ff91c9e54bf:status\" \"86400\"\r\n+1324929860.279169 \"INCRBY\" \"resque:stat:processed\" \"1\"\r\n+1324929860.281834 \"INCRBY\" \"resque:stat:processed:NaWebTeste:12380:default\" \"1\"\r\n+1324929860.282073 \"INCRBY\" \"resque:stat:processed\" \"1\"\r\n+1324929860.282083 \"INCRBY\" \"resque:stat:processed\" \"1\"\r\n+1324929860.282324 \"INCRBY\" \"resque:stat:processed:NaWebTeste:12377:default\" \"1\"\r\n+1324929860.282540 \"INCRBY\" \"resque:stat:processed:NaWebTeste:12378:default\" \"1\"\r\n+1324929860.282554 \"DEL\" \"resque:worker:NaWebTeste:12378:default\"\r\n+1324929860.282828 \"DEL\" \"resque:worker:NaWebTeste:12377:default\"\r\n+1324929860.283045 \"LPOP\" \"resque:queue:default\"\r\n+1324929860.283317 \"LPOP\" \"resque:queue:default\"\r\n+1324929860.283478 \"DEL\" \"resque:worker:NaWebTeste:12380:default\"\r\n+1324929860.283739 \"LPOP\" \"resque:queue:default\"\r\n+1324929865.283209 \"LPOP\" \"resque:queue:default\"\r\n+1324929865.283676 \"LPOP\" \"resque:queue:default\"\r\n+1324929865.284125 \"LPOP\" \"resque:queue:default\"\r\n+1324929870.283742 \"LPOP\" \"resque:queue:default\"\r\n+1324929870.284014 \"LPOP\" \"resque:queue:default\"\r\n+1324929870.284457 \"LPOP\" \"resque:queue:default\"\r\n+1324929875.284328 \"LPOP\" \"resque:queue:default\"\r\n+1324929875.284472 \"LPOP\" \"resque:queue:default\"\r\n+1324929875.284796 \"LPOP\" \"resque:queue:default\"\r\n+1324929880.284926 \"LPOP\" \"resque:queue:default\"\r\n+1324929880.285111 \"LPOP\" \"resque:queue:default\"\r\n+1324929880.285364 \"LPOP\" \"resque:queue:default\"\r\n´´´","url":"https://api.github.com/repos/chrisboulton/php-resque/issues/comments/3276612"},"action":"created"}