java.lang.ArithmeticException: / by zero

JIRA | Olaf Freyer | 10 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    java.lang.ArithmeticException: / by zero Stacktrace: java.lang.ArithmeticException: / by zero at org.archive.io.RecordingOutputStream.checkLimits(RecordingOutputStream.java:271) at org.archive.io.RecordingOutputStream.write(RecordingOutputStream.java:225) at org.archive.io.RecordingInputStream.read(RecordingInputStream.java:104) at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:78) at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:106) at org.apache.commons.httpclient.HttpParser.parseHeaders(HttpParser.java:166) at org.apache.commons.httpclient.HttpMethodBase.readResponseHeaders(HttpMethodBase.java:1810) at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1614) at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1002) at org.archive.httpclient.HttpRecorderGetMethod.execute(HttpRecorderGetMethod.java:116) at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397) at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346) at org.archive.crawler.fetcher.FetchHTTP.innerProcess(FetchHTTP.java:500) at org.archive.crawler.framework.Processor.process(Processor.java:109) at org.archive.crawler.framework.ToeThread.processCrawlUri(ToeThread.java:302) at org.archive.crawler.framework.ToeThread.run(ToeThread.java:151) At first I considered that exception impossible to happen... Unfortunatly its not ;-) Here is basically what happened: long startTime = System.currentTimeMillis(); --> System time gets corrected via ntp a few (milli)seconds into the past long duration = System.currentTimeMillis() - startTime + 1; // !divzero if(position/duration > maxRateBytesPerMs) { --> kaboom (cause duration was 0 even though we thought we were smart and simply added 1) Thanks alot for attending this lecture of "don't consider time a strictly monotonic increasing function"... Regards Olaf Freyer

    JIRA | 10 years ago | Olaf Freyer
    java.lang.ArithmeticException: / by zero
  2. 0

    java.lang.ArithmeticException: / by zero Stacktrace: java.lang.ArithmeticException: / by zero at org.archive.io.RecordingOutputStream.checkLimits(RecordingOutputStream.java:271) at org.archive.io.RecordingOutputStream.write(RecordingOutputStream.java:225) at org.archive.io.RecordingInputStream.read(RecordingInputStream.java:104) at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:78) at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:106) at org.apache.commons.httpclient.HttpParser.parseHeaders(HttpParser.java:166) at org.apache.commons.httpclient.HttpMethodBase.readResponseHeaders(HttpMethodBase.java:1810) at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1614) at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1002) at org.archive.httpclient.HttpRecorderGetMethod.execute(HttpRecorderGetMethod.java:116) at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397) at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346) at org.archive.crawler.fetcher.FetchHTTP.innerProcess(FetchHTTP.java:500) at org.archive.crawler.framework.Processor.process(Processor.java:109) at org.archive.crawler.framework.ToeThread.processCrawlUri(ToeThread.java:302) at org.archive.crawler.framework.ToeThread.run(ToeThread.java:151) At first I considered that exception impossible to happen... Unfortunatly its not ;-) Here is basically what happened: long startTime = System.currentTimeMillis(); --> System time gets corrected via ntp a few (milli)seconds into the past long duration = System.currentTimeMillis() - startTime + 1; // !divzero if(position/duration > maxRateBytesPerMs) { --> kaboom (cause duration was 0 even though we thought we were smart and simply added 1) Thanks alot for attending this lecture of "don't consider time a strictly monotonic increasing function"... Regards Olaf Freyer

    JIRA | 10 years ago | Olaf Freyer
    java.lang.ArithmeticException: / by zero
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ArithmeticException

      / by zero

      at org.archive.io.RecordingOutputStream.checkLimits()
    2. webarchive-commons
      RecordingInputStream.read
      1. org.archive.io.RecordingOutputStream.checkLimits(RecordingOutputStream.java:271)
      2. org.archive.io.RecordingOutputStream.write(RecordingOutputStream.java:225)
      3. org.archive.io.RecordingInputStream.read(RecordingInputStream.java:104)
      3 frames
    3. HttpClient
      HttpMethodBase.execute
      1. org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:78)
      2. org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:106)
      3. org.apache.commons.httpclient.HttpParser.parseHeaders(HttpParser.java:166)
      4. org.apache.commons.httpclient.HttpMethodBase.readResponseHeaders(HttpMethodBase.java:1810)
      5. org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1614)
      6. org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1002)
      6 frames
    4. webarchive-commons
      HttpRecorderGetMethod.execute
      1. org.archive.httpclient.HttpRecorderGetMethod.execute(HttpRecorderGetMethod.java:116)
      1 frame
    5. HttpClient
      HttpClient.executeMethod
      1. org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
      2. org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
      3. org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
      4. org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
      4 frames
    6. org.archive.crawler
      ToeThread.run
      1. org.archive.crawler.fetcher.FetchHTTP.innerProcess(FetchHTTP.java:500)
      2. org.archive.crawler.framework.Processor.process(Processor.java:109)
      3. org.archive.crawler.framework.ToeThread.processCrawlUri(ToeThread.java:302)
      4. org.archive.crawler.framework.ToeThread.run(ToeThread.java:151)
      4 frames