java.lang.ArithmeticException: / by zero

JIRA | Johan Ström | 4 years ago
  1. 0

    Hi, I'm having trouble using capabilities with the java compat libraries. An isolated test case below gives the following stack trace: {noformat} java.lang.ArithmeticException: / by zero at com.linkedin.norbert.network.client.loadbalancer.LoadBalancerHelpers$class.chooseNext(LoadBalancerFactory.scala:76) at com.linkedin.norbert.network.client.loadbalancer.RoundRobinLoadBalancerFactory.chooseNext(RoundRobinLoadBalancerFactory.scala:26) at com.linkedin.norbert.network.client.loadbalancer.RoundRobinLoadBalancerFactory$$anon$1.nextNode(RoundRobinLoadBalancerFactory.scala:36) at com.linkedin.norbert.javacompat.network.RoundRobinLoadBalancerFactory$1.nextNode(RoundRobinLoadBalancerFactory.java:44) {noformat} The same exception can be triggered by sendRequest(..capability..) via underlying(). This is somewhat hacky, but sendRequest(..capability..) is not available in the java interface (maybe intentional?) {code} ClusterClient cc = new InMemoryClusterClient(null, "unittest"); cc.awaitConnectionUninterruptibly(); cc.addNode(1, "localhost:12340"); NetworkServerConfig srvCfg = new NetworkServerConfig(); srvCfg.setClusterClient(cc); NettyNetworkServer ns = new NettyNetworkServer(srvCfg); ns.bind(1, true, 1L); // capability 1 NetworkClientConfig cliCfg = new NetworkClientConfig(); cliCfg.setClusterClient(cc); NettyNetworkClient nc = new NettyNetworkClient(cliCfg, new RoundRobinLoadBalancerFactory()); System.out.println("cc.getNodes() : "+cc.getNodes()); Either eitherLb =(Either) nc.underlying().com$linkedin$norbert$network$client$NetworkClient$$loadBalancer().get(); Object r = eitherLb.right().get(); LoadBalancer lb = (LoadBalancer)r; System.out.println("lb.nextNode : "+lb.nextNode()); System.out.println("lb.nextNode(0) : "+lb.nextNode(Option.apply(0L))); System.out.println("lb.nextNode(1) : "+lb.nextNode(Option.apply(1L))); {code} The output is: {noformat} cc.getNodes() : [JavaNode(1,localhost:12340,true,[],Some(1))] lb.nextNode : Some(Node(1,localhost:12340,[],true,0x00000000)) lb.nextNode(0) : Some(Node(1,localhost:12340,[],true,0x00000000)) {noformat} The last code line fails with the exception above. Note that the cc.getNodes() (which gives the java-version of the node) indicates the right capabilities, but the Scala node from nextNode version doesn't seem to have the capabilities? This is on current HEAD (69c3a7ccbaf22d751f6282e7b6eb9dab19b04954), but the problem occurs on 0.6.29-SNAPSHOT as well. A patch for RoundRobinLoadBalancerFactory.scala is attached, but this only fixes the divide-by-zero bug.. I still don't get any nodes, and my scala/norbert internals experience is not that high-level, so any pointers/patches/suggestions are welcome! Thanks

    JIRA | 4 years ago | Johan Ström
    java.lang.ArithmeticException: / by zero
  2. 0

    Hi, I'm having trouble using capabilities with the java compat libraries. An isolated test case below gives the following stack trace: {noformat} java.lang.ArithmeticException: / by zero at com.linkedin.norbert.network.client.loadbalancer.LoadBalancerHelpers$class.chooseNext(LoadBalancerFactory.scala:76) at com.linkedin.norbert.network.client.loadbalancer.RoundRobinLoadBalancerFactory.chooseNext(RoundRobinLoadBalancerFactory.scala:26) at com.linkedin.norbert.network.client.loadbalancer.RoundRobinLoadBalancerFactory$$anon$1.nextNode(RoundRobinLoadBalancerFactory.scala:36) at com.linkedin.norbert.javacompat.network.RoundRobinLoadBalancerFactory$1.nextNode(RoundRobinLoadBalancerFactory.java:44) {noformat} The same exception can be triggered by sendRequest(..capability..) via underlying(). This is somewhat hacky, but sendRequest(..capability..) is not available in the java interface (maybe intentional?) {code} ClusterClient cc = new InMemoryClusterClient(null, "unittest"); cc.awaitConnectionUninterruptibly(); cc.addNode(1, "localhost:12340"); NetworkServerConfig srvCfg = new NetworkServerConfig(); srvCfg.setClusterClient(cc); NettyNetworkServer ns = new NettyNetworkServer(srvCfg); ns.bind(1, true, 1L); // capability 1 NetworkClientConfig cliCfg = new NetworkClientConfig(); cliCfg.setClusterClient(cc); NettyNetworkClient nc = new NettyNetworkClient(cliCfg, new RoundRobinLoadBalancerFactory()); System.out.println("cc.getNodes() : "+cc.getNodes()); Either eitherLb =(Either) nc.underlying().com$linkedin$norbert$network$client$NetworkClient$$loadBalancer().get(); Object r = eitherLb.right().get(); LoadBalancer lb = (LoadBalancer)r; System.out.println("lb.nextNode : "+lb.nextNode()); System.out.println("lb.nextNode(0) : "+lb.nextNode(Option.apply(0L))); System.out.println("lb.nextNode(1) : "+lb.nextNode(Option.apply(1L))); {code} The output is: {noformat} cc.getNodes() : [JavaNode(1,localhost:12340,true,[],Some(1))] lb.nextNode : Some(Node(1,localhost:12340,[],true,0x00000000)) lb.nextNode(0) : Some(Node(1,localhost:12340,[],true,0x00000000)) {noformat} The last code line fails with the exception above. Note that the cc.getNodes() (which gives the java-version of the node) indicates the right capabilities, but the Scala node from nextNode version doesn't seem to have the capabilities? This is on current HEAD (69c3a7ccbaf22d751f6282e7b6eb9dab19b04954), but the problem occurs on 0.6.29-SNAPSHOT as well. A patch for RoundRobinLoadBalancerFactory.scala is attached, but this only fixes the divide-by-zero bug.. I still don't get any nodes, and my scala/norbert internals experience is not that high-level, so any pointers/patches/suggestions are welcome! Thanks

    JIRA | 4 years ago | Johan Ström
    java.lang.ArithmeticException: / by zero
  3. 0

    Report

    GitHub | 1 year ago | jsql-robot
    java.lang.ArithmeticException: / by zero
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    [1.10.2] Crash on loading world

    GitHub | 3 months ago | Messorix
    java.lang.ArithmeticException: / by zero
  6. 0

    Shape problem

    Oracle Community | 1 decade ago | 843805
    java.lang.ArithmeticException: / by zero

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ArithmeticException

      / by zero

      at com.linkedin.norbert.network.client.loadbalancer.LoadBalancerHelpers$class.chooseNext()
    2. com.linkedin.norbert
      RoundRobinLoadBalancerFactory$1.nextNode
      1. com.linkedin.norbert.network.client.loadbalancer.LoadBalancerHelpers$class.chooseNext(LoadBalancerFactory.scala:76)
      2. com.linkedin.norbert.network.client.loadbalancer.RoundRobinLoadBalancerFactory.chooseNext(RoundRobinLoadBalancerFactory.scala:26)
      3. com.linkedin.norbert.network.client.loadbalancer.RoundRobinLoadBalancerFactory$$anon$1.nextNode(RoundRobinLoadBalancerFactory.scala:36)
      4. com.linkedin.norbert.javacompat.network.RoundRobinLoadBalancerFactory$1.nextNode(RoundRobinLoadBalancerFactory.java:44)
      4 frames