java.lang.ArrayIndexOutOfBoundsException: -255

Jenkins JIRA | Josh Gibbs | 3 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

    This issue is essentially identical to JENKINS-9120, where an integer gets incremented but never decremented. After a large number of calls, the integer overflows. SEVERE: Error within request handler thread java.lang.ArrayIndexOutOfBoundsException: -255 at com.cloudbees.jenkins.support.SupportLogHandler.publish(SupportLogHandler.java:106) at java.util.logging.Logger.log(Logger.java:570) at java.util.logging.Logger.doLog(Logger.java:592) at java.util.logging.Logger.log(Logger.java:681) at winstone.Logger.logInternal(Logger.java:157) at winstone.Logger.log(Logger.java:183) at winstone.HttpListener.allocateRequestResponse(HttpListener.java:182) at winstone.RequestHandlerThread.run(RequestHandlerThread.java:69) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:701) The problem is here in SupportLogHandler's publish method: int maxCount = records.length; records[(position + count) % maxCount] = record; if (count == maxCount) { position++; } else { count++; } Once count is equal to maxCount, count will never be incremented. However, position will be incremented indefinitely from then on. Position should instead be set to something like this: position = (position + 1) % maxCount;

    Jenkins JIRA | 3 years ago | Josh Gibbs
    java.lang.ArrayIndexOutOfBoundsException: -255
  2. 0

    This issue is essentially identical to JENKINS-9120, where an integer gets incremented but never decremented. After a large number of calls, the integer overflows. SEVERE: Error within request handler thread java.lang.ArrayIndexOutOfBoundsException: -255 at com.cloudbees.jenkins.support.SupportLogHandler.publish(SupportLogHandler.java:106) at java.util.logging.Logger.log(Logger.java:570) at java.util.logging.Logger.doLog(Logger.java:592) at java.util.logging.Logger.log(Logger.java:681) at winstone.Logger.logInternal(Logger.java:157) at winstone.Logger.log(Logger.java:183) at winstone.HttpListener.allocateRequestResponse(HttpListener.java:182) at winstone.RequestHandlerThread.run(RequestHandlerThread.java:69) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:701) The problem is here in SupportLogHandler's publish method: int maxCount = records.length; records[(position + count) % maxCount] = record; if (count == maxCount) { position++; } else { count++; } Once count is equal to maxCount, count will never be incremented. However, position will be incremented indefinitely from then on. Position should instead be set to something like this: position = (position + 1) % maxCount;

    Jenkins JIRA | 3 years ago | Josh Gibbs
    java.lang.ArrayIndexOutOfBoundsException: -255

    Root Cause Analysis

    1. java.lang.ArrayIndexOutOfBoundsException

      -255

      at com.cloudbees.jenkins.support.SupportLogHandler.publish()
    2. com.cloudbees.jenkins
      SupportLogHandler.publish
      1. com.cloudbees.jenkins.support.SupportLogHandler.publish(SupportLogHandler.java:106)
      1 frame
    3. Java RT
      Logger.log
      1. java.util.logging.Logger.log(Logger.java:570)
      2. java.util.logging.Logger.doLog(Logger.java:592)
      3. java.util.logging.Logger.log(Logger.java:681)
      3 frames
    4. winstone
      RequestHandlerThread.run
      1. winstone.Logger.logInternal(Logger.java:157)
      2. winstone.Logger.log(Logger.java:183)
      3. winstone.HttpListener.allocateRequestResponse(HttpListener.java:182)
      4. winstone.RequestHandlerThread.run(RequestHandlerThread.java:69)
      4 frames
    5. Java RT
      FutureTask.run
      1. java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      2. java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      3. java.util.concurrent.FutureTask.run(FutureTask.java:166)
      3 frames
    6. winstone
      BoundedExecutorService$1.run
      1. winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
      1 frame
    7. Java RT
      Thread.run
      1. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
      2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      3. java.lang.Thread.run(Thread.java:701)
      3 frames