Error that crashes world..

Discussion in 'Plugin Development' started by dillyg10, May 15, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    dillyg10

    HI I have this code http://pastie.org/3917296 it works some of the time, but other times it ends up throwing this exception that crashes the world http://pastie.org/3917319 if anyone can help, would be great :).

    bump :).

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 25, 2016
  2. Offline

    desht

    Are you trying to run this code from an async task?
     
  3. Offline

    Njol

    I guess you run this code in an async task or a separate thread of you own, which you should never do as almost none of Bukkit's methods are thread-safe. Let the main server thread execute the code and you'll be fine.
     
  4. Offline

    dillyg10

    No, this could should be executing on the main server thread.
     
  5. Offline

    Njol

    Can you post the rest of the code as well?
     
  6. Offline

    Double0negative

    From my experience this happens when an operation takes a long time to complete and causes the server to hang and/or when you are editing lots of blocks on different threads. Ive seen this happen with large worledit edits and experimenting with copy and paste lots of blocks across multiple threads
     
  7. Offline

    dillyg10

    Do you have any suggestions?
     
  8. Offline

    Double0negative

    Note really, i tried lots of different things but they all seemed to end up doing the same things, but incase comparing code helps at all

    https://gist.github.com/2711987
     
  9. Offline

    Njol

    You should've guessed at the first "TickNextTick out of sync" that there is some issue with changing blocks from a separate thread, and not tried to circumvent it.
    If you don't know what the issue is read my first post from this thread again:
    Not thread-safe means that you must not use these methods from any different thread than the main server thread, even if it seems to work.
     
  10. Offline

    Double0negative

    Notice that I said i was experimenting.
     
Thread Status:
Not open for further replies.

Share This Page