Catching an illegal state

  • Hi @red51


    Is there a method in which I can catch an illegal state and cancel the event?


    I'm getting a few:


    Code
    INFO: Player <playername> illegal state: InventoryStackExchange: Origin item is null

    I'm finding it difficult to replicate the exact cause, sometimes I can get it to happen, other times I can't. ?(





    Edit: not super important as it doesn't seem to happen often. . . also, it seems to happen when splitting stacks.

  • Sounds for me like this problem is connected to the problem that items disappear if you SHIFT a stackable item into a box and back. Maybe you can try this and check if this is the cause?

    Gamer aus Leidenschaft
    (Web) Entwickler aus Leidenschaft
    <3 Vater aus Leidenschaft <3
    (prio in aufsteigender Sortierung ;) )


    ~~~~~~~~~~~~~~~~~
    1. Entweder man macht etwas richtig oder lässt es bleiben!
    2. Egal wie lange etwas dauert, Hauptsache es wird fertig (irgendwann)
    ------------------------
    Discord: Devidian#1334

  • In general, an illegal state error occurs if there is some sort of desync between the client and the server. More precisely, the client is acting in a way that's not plausible for the server. In most cases this is either caused by bugs or desync, although it might also be caused by modified game files. The server can set a "threshold" when the client should be kicked ("settings_illegal_state_limit" in the server.properties file).


    We can add a PlayerIllegalStateEvent with the next update, although I'm not sure about cancelling the event. If the event gets cancelled, the client will not be kicked from the server. But a client that is no longer in sync with the server might cause other issues =O

  • maybe calling some sort of resync or reconnect then?

    Well, if too many "illegal state errors" occur for a certain player, he will be kicked, therefore he's forced to reconnect anyway (which will fix the desync) ^^ However, the whole "illegal state error" stuff is also in place to protect the server from hackers. Right now there aren't many hackers in RW (if any), so this error is mostly caused by bugs. Ideally every bug which triggers this issue (or more precisely, which causes the desync) will be fixed in the long run, so at the end of the day, this might be a reliable server protection.


    If an illegal state error occurs, the best thing is to report this issue (with a server log or something like that) :)

  • Sure, that sounds like the best idea ;) If you add an event for this i could add it to my communications plugins and the servers could report it then by himself maybe (or check and save which player causes this - if the player causes this on different servers he may be a hacker and could be banned automatically for example :D )

    Gamer aus Leidenschaft
    (Web) Entwickler aus Leidenschaft
    <3 Vater aus Leidenschaft <3
    (prio in aufsteigender Sortierung ;) )


    ~~~~~~~~~~~~~~~~~
    1. Entweder man macht etwas richtig oder lässt es bleiben!
    2. Egal wie lange etwas dauert, Hauptsache es wird fertig (irgendwann)
    ------------------------
    Discord: Devidian#1334

  • Hmm well a little more info.


    I see these illegal state messages whilst working on a local test server (i.e. 127.0.0.1) (and both client and server are not modified).


    If I pick up a stack and split it - usually splitting the stack into an inventory location other than the origin I get these messages on the server log. Not always, but sometimes.


    For example, pick up a stack of 64 ingots of iron from a chest, then right click to drop 1 ingot into my "local" inventory. The stack split will happen but I see this message on the server (again, sometimes but not always).


    This "illegal state" message will continue for each subsequent stack split. Whilst the stack is still in use. Dropping the stack back to original chest, left clicking on another item and then accessing the original item (i.e. 64 ingots of iron) then stops the message.


    A PlayerIllegalStateEvent would be good for starters even if I don't choose to cancel the event, at least I can create a log file. That way I can determine the frequency of these events as well as any pattern (i.e. if its specific players mainly causing them or like with my testing an infrequent anomaly).

  • We will definitely add the "PlayerIllegalStateEvent" with the next update :)
    The "illegal state error" related to item moving / splitting stacks should also be fixed with the next update. If you still experience this issue after the update, please let us know ;)

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!