{"action":"opened","issue":{"url":"https://api.github.com/repos/gresrun/jesque/issues/98","labels_url":"https://api.github.com/repos/gresrun/jesque/issues/98/labels{/name}","comments_url":"https://api.github.com/repos/gresrun/jesque/issues/98/comments","events_url":"https://api.github.com/repos/gresrun/jesque/issues/98/events","html_url":"https://github.com/gresrun/jesque/issues/98","id":129427893,"number":98,"title":"java.lang.ClassCastException: [B cannot be cast to java.lang.Long","user":{"login":"m8r-ubnc5g","id":14198377,"avatar_url":"https://avatars.githubusercontent.com/u/14198377?v=3","gravatar_id":"","url":"https://api.github.com/users/m8r-ubnc5g","html_url":"https://github.com/m8r-ubnc5g","followers_url":"https://api.github.com/users/m8r-ubnc5g/followers","following_url":"https://api.github.com/users/m8r-ubnc5g/following{/other_user}","gists_url":"https://api.github.com/users/m8r-ubnc5g/gists{/gist_id}","starred_url":"https://api.github.com/users/m8r-ubnc5g/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m8r-ubnc5g/subscriptions","organizations_url":"https://api.github.com/users/m8r-ubnc5g/orgs","repos_url":"https://api.github.com/users/m8r-ubnc5g/repos","events_url":"https://api.github.com/users/m8r-ubnc5g/events{/privacy}","received_events_url":"https://api.github.com/users/m8r-ubnc5g/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-01-28T11:44:26Z","updated_at":"2016-01-28T11:44:26Z","closed_at":null,"body":"Is #90 really fixed?  I have seen a similar Exception in my code. I have written a little ugly presentation test to show, that this exception can still be thrown.\r\n\r\nI'm using jesque v2.1.1\r\n\r\nSome informations about my redis DB:\r\n```\r\n> 127.0.0.1:6379> INFO\r\n> # Server\r\n> redis_version:2.8.4\r\n> redis_git_sha1:00000000\r\n> redis_git_dirty:0\r\n> redis_build_id:a44a05d76f06a5d9\r\n> redis_mode:standalone\r\n> os:Linux 3.19.0-32-generic x86_64\r\n> arch_bits:64\r\n> multiplexing_api:epoll\r\n> gcc_version:4.8.2\r\n> process_id:2863\r\n> run_id:77826f62f35753f66b72d04f349650fa3c2f3071\r\n> tcp_port:6379\r\n> uptime_in_seconds:90919\r\n> uptime_in_days:1\r\n> hz:10\r\n> lru_clock:694402\r\n> config_file:/etc/redis/redis.conf\r\n```\r\n\r\n\r\nAnd below there is the test class. I know that this code is not very cool, but it shows this exception:\r\n\r\n```\r\nException in thread \"Worker-2 Jesque-2.1.1: STOPPING\" java.lang.ClassCastException: [B cannot be cast to java.lang.Long\r\n\tat redis.clients.jedis.Connection.getIntegerReply(Connection.java:222)\r\n\tat redis.clients.jedis.Jedis.srem(Jedis.java:1091)\r\n\tat net.greghaines.jesque.worker.WorkerImpl.run(WorkerImpl.java:198)\r\n\tat java.lang.Thread.run(Thread.java:745)\r\n```\r\n\r\nPlease notice the timeout is set to 20. If I increase the timeout to e.g.  5.000 (default), then the ClassCastException is not thrown (or perhaps the test have to run longer than before!). \r\n\r\n\r\n```\r\n\r\nimport java.time.ZonedDateTime;\r\nimport java.util.ArrayList;\r\nimport java.util.HashMap;\r\nimport java.util.List;\r\nimport java.util.Map;\r\nimport java.util.Random;\r\nimport java.util.concurrent.atomic.AtomicLong;\r\n\r\nimport net.greghaines.jesque.Config;\r\nimport net.greghaines.jesque.ConfigBuilder;\r\nimport net.greghaines.jesque.Job;\r\nimport net.greghaines.jesque.client.ClientPoolImpl;\r\nimport net.greghaines.jesque.worker.JobFactory;\r\nimport net.greghaines.jesque.worker.Worker;\r\nimport net.greghaines.jesque.worker.WorkerEvent;\r\nimport net.greghaines.jesque.worker.WorkerImplFactory;\r\nimport net.greghaines.jesque.worker.WorkerListener;\r\nimport net.greghaines.jesque.worker.WorkerPool;\r\n\r\nimport org.joda.time.Duration;\r\nimport org.slf4j.Logger;\r\nimport org.slf4j.LoggerFactory;\r\n\r\nimport redis.clients.jedis.JedisPool;\r\n\r\npublic class TestJesqueWorkerPoolTest2 {\r\n\r\n\tprivate static final Logger LOG = LoggerFactory.getLogger(JesqueWorkerPoolTest.class);\r\n\r\n\tprivate static final Random RANDOM = new Random();\r\n\tprivate static final Object[] args = new Object[] {};\r\n\tprivate static final Map<String, ? extends Object> vars = new HashMap<String, Object>();\r\n\tprivate static final String className = JesqueWorkerPoolTest.class.getName();\r\n\r\n\tprivate static final String Q_NAME = \"JustTESTQ\";\r\n\tprivate static final List<String> queues = new ArrayList<String>();\r\n\tstatic {\r\n\t\tqueues.add(Q_NAME);\r\n\t}\r\n\r\n\tprivate static volatile long lastRun = System.currentTimeMillis();\r\n\tprivate static volatile AtomicLong workerStopCounter = new AtomicLong();\r\n\r\n\tpublic static void main(\r\n\t\t\tString[] mainargs) {\r\n\t\tAtomicLong jobCounter = new AtomicLong();\r\n\r\n\t\tConfig jesqueConfig = getConfig();\r\n\r\n\t\tJobFactory jobFactory = new JobFactory() {\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic Object materializeJob(\r\n\t\t\t\t\tJob job) throws Exception {\r\n\t\t\t\treturn new Runnable() {\r\n\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tpublic void run() {\r\n\t\t\t\t\t\tSystem.out.println(\"Run JOB:\" + jobCounter.getAndIncrement());\r\n\t\t\t\t\t\tlastRun = System.currentTimeMillis();\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tClientPoolImpl jesqueClientPool = new ClientPoolImpl(jesqueConfig, new JedisPool(jesqueConfig.getHost()));\r\n\r\n\t\tWorkerImplFactory workerFactory = new WorkerImplFactory(jesqueConfig, queues, jobFactory);\r\n\t\tWorkerPool workerPool = new WorkerPool(workerFactory, 4);\r\n\r\n\t\tworkerPool.getWorkerEventEmitter().addListener(new WorkerListener() {\r\n\t\t\t@Override\r\n\t\t\tpublic void onEvent(\r\n\t\t\t\t\tWorkerEvent event,\r\n\t\t\t\t\tWorker worker,\r\n\t\t\t\t\tString queue,\r\n\t\t\t\t\tJob job,\r\n\t\t\t\t\tObject runner,\r\n\t\t\t\t\tObject result,\r\n\t\t\t\t\tThrowable t) {\r\n\t\t\t\tZonedDateTime lastWorkerProblemEventTime = ZonedDateTime.now();\r\n\t\t\t\tString lastWorkerProblemMsg = String.format(\r\n\t\t\t\t\t\t\"Event '%s' @ %s:%s@%s. JobArgs: %s; JobVars:%s. EventTime:%s\", event == null ? \"<EventIsNull>\"\r\n\t\t\t\t\t\t\t\t: event.toString(), worker == null ? \"<WorkerIsNull>\" : worker.getName(), queue,\r\n\t\t\t\t\t\trunner == null ? \"<RunnerIsNull>\" : runner.getClass().getSimpleName(),\r\n\t\t\t\t\t\tjob != null ? job.getArgs() : \"null\", job != null ? job.getVars() : \"null\",\r\n\t\t\t\t\t\tlastWorkerProblemEventTime.toString());\r\n\t\t\t\tif (t == null) {\r\n\t\t\t\t\tLOG.info(lastWorkerProblemMsg);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tLOG.warn(lastWorkerProblemMsg, t);\r\n\t\t\t\t}\r\n\t\t\t\tif (event.compareTo(WorkerEvent.WORKER_STOP) == 0) {\r\n\t\t\t\t\tworkerStopCounter.incrementAndGet();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tlong startWokerPool = System.currentTimeMillis();\r\n\t\tworkerPool.run();\r\n\t\tlong waitTimeMS = 5000;\r\n\t\twhile ((lastRun + waitTimeMS) > System.currentTimeMillis()) {\r\n\t\t\tjesqueClientPool.enqueue(Q_NAME, new Job(className, args, vars));\r\n\t\t\tLOG.info(\"workerStopCounter:\" + workerStopCounter.get());\r\n\t\t\ttry {\r\n\t\t\t\tThread.sleep(RANDOM.nextInt(100));\r\n\t\t\t} catch (InterruptedException e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t}\r\n\t\tlong endWorkerPool = System.currentTimeMillis() - waitTimeMS;\r\n\r\n\t\tLOG.info(\"jobCounter:\" + jobCounter.get());\r\n\t\tLOG.info(\"workerStopCounter:\" + workerStopCounter.get());\r\n\t\tlong workerDurationMS = endWorkerPool - startWokerPool;\r\n\t\tLOG.info(\"WorkerPoolWorkTime:\" + new Duration(workerDurationMS));\r\n\t\tLOG.info(\"workerPool.isShutdown():\" + workerPool.isShutdown());\r\n\t}\r\n\r\n\tprivate static Config getConfig() {\r\n\t\tConfigBuilder configBuilder = new ConfigBuilder();\r\n\t\tconfigBuilder.withHost(\"myredishost\");\r\n\t\tconfigBuilder.withTimeout(20);\r\n\t\tconfigBuilder.withPort(6379);\r\n\t\treturn configBuilder.build();\r\n\t}\r\n\r\n}\r\n\r\n```\r\n\r\nPerhaps the problem of Stopping workers due to some known exceptions could be reduced (workaround), if the Pool would spawn new Workers if there is the _WorkerEvent.WORKER_STOP_ event with this type of Exception? Because now I have to monitor the WorkerPool and start own workers or in the end I'm stucked because all workers are down.\r\n\r\n`"}}