reiseburo / hermann

A gem providing cross-platform Kafka producer and consumer support
MIT License
71 stars 76 forks source link

Hermann needs to handle load errors better #124

Closed rtyler closed 9 years ago

rtyler commented 9 years ago

(filing this issue here, it is originally from another developer at @Lookout)

Hermann should catch and handle exceptions like below, at worse raise StandardError.

Attempt to create an instance of producer was failing silently. In this case the issue was that hermann was not pulling the correct zk jar it/curator needed and throwing a java.lang.Error.

I had to rescue Exception to determine the exact issue. I cannot make the rescue Exception block permanent since it's bad practice.

ERROR: 2015-06-22T19:15:46Z: /REDACTED.rb:129: Caught exception org.apache.zookeeper.ZooKeeper.<init>(Ljava/lang/String;ILorg/apache/zookeeper/Watcher;Z)V: ["org.apache.curator.utils.DefaultZookeeperFactory.newZooKeeper(org/apache/curator/utils/DefaultZookeeperFactory.java:29)", "org.apache.curator.framework.imps.CuratorFrameworkImpl$2.newZooKeeper(org/apache/curator/framework/imps/CuratorFrameworkImpl.java:146)", "org.apache.curator.HandleHolder$1.getZooKeeper(org/apache/curator/HandleHolder.java:94)", "org.apache.curator.HandleHolder.getZooKeeper(org/apache/curator/HandleHolder.java:55)", "org.apache.curator.ConnectionState.reset(org/apache/curator/ConnectionState.java:218)", "org.apache.curator.ConnectionState.start(org/apache/curator/ConnectionState.java:102)", "org.apache.curator.CuratorZookeeperClient.start(org/apache/curator/CuratorZookeeperClient.java:189)", "org.apache.curator.framework.imps.CuratorFrameworkImpl.start(org/apache/curator/framework/imps/CuratorFrameworkImpl.java:248)", "java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:606)", "RUBY.brokers(/home/vagrant/.rvm/gems/jruby-1.7.20.1@REDACTED/gems/hermann-0.24.1.0-java/lib/hermann/discovery/zookeeper.rb:139)", "RUBY.get_brokers(/home/vagrant/.rvm/gems/jruby-1.7.20.1@REDACTED/gems/hermann-0.24.1.0-java/lib/hermann/discovery/zookeeper.rb:39)", "RUBY.init_producer(/l4e/backend/broker.rb:122)", "RUBY.get_producer(REDACTED.rb:97)", "RUBY.publish_message(REDACTED.rb:69)", "RUBY.publish_message(/home/vagrant/.rvm/gems/jruby-1.7.20.1@REDACTED/gems/concurrent-ruby-0.7.2-java/lib/concurrent/async.rb:90)", "org.jruby.RubyProc.call(org/jruby/RubyProc.java:271)", "RUBY.call(/home/vagrant/.rvm/gems/jruby-1.7.20.1@REDACTED/gems/concurrent-ruby-0.7.2-java/lib/concurrent/executor/serialized_execution.rb:15)", "RUBY.work(/home/vagrant/.rvm/gems/jruby-1.7.20.1@REDACTED/gems/concurrent-ruby-0.7.2-java/lib/concurrent/executor/serialized_execution.rb:95)", "RUBY.call_job(/home/vagrant/.rvm/gems/jruby-1.7.20.1@REDACTED/gems/concurrent-ruby-0.7.2-java/lib/concurrent/executor/serialized_execution.rb:76)", "RUBY.post(/home/vagrant/.rvm/gems/jruby-1.7.20.1@REDACTED/gems/concurrent-ruby-0.7.2-java/lib/concurrent/executor/executor.rb:0)", "org.jruby.gen.InterfaceImpl2131200830.run(org/jruby/gen/InterfaceImpl2131200830.gen:13)", "java.util.concurrent.Executors$RunnableAdapter.call(java/util/concurrent/Executors.java:471)", "java.util.concurrent.FutureTask.run(java/util/concurrent/FutureTask.java:262)", "java.util.concurrent.ThreadPoolExecutor.runWorker(java/util/concurrent/ThreadPoolExecutor.java:1145)", "java.util.concurrent.ThreadPoolExecutor$Worker.run(java/util/concurrent/ThreadPoolExecutor.java:615)", "java.lang.Thread.run(java/lang/Thread.java:745)"]