Solved Serious PID Error 17 crashed server, need a fix!

Discussion in 'Spigot Plugin Development' started by WulfGamesYT, Jun 3, 2018.

  1. Hey I had an error in console that crashed one of my servers, the error is (in 2 parts):

    > [12:56:18 ERROR]: Current Thread: pool-5-thread-9
    > [12:56:18 ERROR]: PID: 109 | Suspended: false | Native: false | State: TIMED_WAITING
    > [12:56:18 ERROR]: Stack:
    > [12:56:18 ERROR]: sun.misc.Unsafe.park(Native Method)
    > [12:56:18 ERROR]: java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
    > [12:56:18 ERROR]: java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:460)
    > [12:56:18 ERROR]: java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)
    > [12:56:18 ERROR]: java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:941)
    > [12:56:18 ERROR]: java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1073)
    > [12:56:18 ERROR]: java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
    > [12:56:18 ERROR]: java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    > [12:56:18 ERROR]: java.lang.Thread.run(Thread.java:748)

    > [12:56:18 ERROR]: The server has stopped responding!
    > [12:56:18 ERROR]: Please report this to http://www.spigotmc.org/
    > [12:56:18 ERROR]: Be sure to include ALL relevant console errors and Minecraft crash reports
    > [12:56:18 ERROR]: Spigot version: git-Spigot-e4d4710-e1ebe52 (MC: 1.8.8)
    > [12:56:18 ERROR]: ------------------------------
    > [12:56:18 ERROR]: Server thread dump (Look for plugins here before reporting to Spigot!):
    > [12:56:18 ERROR]: ------------------------------
    > [12:56:18 ERROR]: Current Thread: Server thread
    > [12:56:18 ERROR]: PID: 17 | Suspended: false | Native: false | State: RUNNABLE
    > [12:56:18 ERROR]: Stack:
    > [12:56:18 ERROR]: me.WulfGamesYT.WulfNetworkHandler.Commands.CommandListener.onPlayerChatEvent(CommandListener.java:31)

    line 31 of my core plugin is:
    while(blockedCommands.hasNext()) {
    It's an iterator of an arraylist...

    --

    any clue what caused this error?
    and why it crashed instead of just reporting the error through console?
     
  2. By the way, the onPlayerChatEvent is a method/void name which I forgot to rename, it's simply the PlayerCommandPreprocessEvent event which yes, is registered and everything. It's been working for ages now.
     
  3. That's a typical Endwhile-Loop. You must detect and remove the bug. Why do you iterate through a list. Use ArrayList#contains(Object)
     
    • Like Like x 1
  4. Good point actually! I will change it to that but for future reference I would like to know how this kind of error would crash a server?
     
  5. Java uses while with a boolean. if the boolean is true the server will run the CommandTask without a goal. Your server will overload and crash
     
    • Like Like x 1
  6. A simple way to iterate through a List is this:
    Code (Text):
    public void iterate() {
      for(int i = 0; i < list.size(); i++) {
        Object o = list.get(i);
      }
    }
     
  7. Thanks for the tips man, appreciate it! Solved for now!