Open gilesknap opened 2 years ago
@conqp do you get why the code above has an issue? I've looked in Client and it creates its own socket. Thus if I have two Client objects they are using separate sockets and there should be no crossover.
Unless Minecraft's RCON server itself is at fault?
I can confirm that adding global lock to mcipc Client fixes the above. BUT if I run two separate processes together then I get the same issue back again.
I think this implies the issue does lie at the server?!!??
Was just about to inquire about this as my application uses multi threading to handle each client.
@BreathXV are you seeing any issues with multi threading? Did you need to do anything to mitigate the problem I'm seeing?
If each thread has its own client this should™ not be an issue. In any case, I'm currently on vacation for the next two weeks, so I cannot work on this before 2024-06-03.
@gilesknap No, I haven't fully tested my application yet but I've been running each instance of the client as a thread, then using it to execute commands, then I start a new thread for another client.
I'll do some testing at some point today and let you know.
I'll do some testing at some point today and let you know.
If you do see problems then I would expect the pr I referenced above would be a workaround (but implemented at the wrong level, really)
However my testing showed the same issue even with that fix if I ran two clients on separate workstations. This implies the rcon server itself has an issue but that is rather surprising.
Should RCON be thread safe if you open a new client per thread?
I have been successfully using this but have started to see a few instances of where the response that should go back to thread A is concatenated to the response for thread B, Thread A gets a null response when this happens.
A minimal demo of the issue is here:
The results of this test show a clash on the first call to both threads. If I adjust the
wait
to be the same I see more clashes.