TheHolyWaffle / TeamSpeak-3-Java-API

A Java wrapper of TeamSpeak's 3 server query API.
MIT License
306 stars 107 forks source link

Indefinite wait when not connected #337

Open marcschuler opened 5 years ago

marcschuler commented 5 years ago

I noticed a weird behaviour in version 1.2.0 where a Thread got stuck in my application. The connection to the server was closed and after that the programm tried to execute a command (whoami). Because there wasn't an connection anymore (and somehow no exception was thrown), the application did wait for an answer it would never receive. And it would wait Indefinitly.

The TS3 error (timeout): ERROR [[TeamSpeak-3-Java-API] SocketReader] c.g.t.t.SocketReader: Connection closed by the server.

The stack trace of the stuck Thread:

        java.base@11.0.3/java.lang.Object.wait(Native Method)
        java.base@11.0.3/java.lang.Object.wait(Object.java:328)
        com.github.theholywaffle.teamspeak3.api.CommandFuture.awaitUninterruptibly(CommandFuture.java:200)
        com.github.theholywaffle.teamspeak3.api.CommandFuture.getUninterruptibly(CommandFuture.java:354)
        com.github.theholywaffle.teamspeak3.TS3Api.whoAmI(TS3Api.java:4576)
rogermb commented 5 years ago

Hi @KarlTheBee

Sorry for taking so long to respond. Had a lot of IRL stuff going on, and it'll probably be another 3-4 weeks until I'll be able to work on this API again.

Yeah, the threading stuff is pretty broken in v1.2.0. I think I've already fixed this in master, though - I've pretty much rewritten the entire command queue system that the query runs on.

You could try to use a SNAPSHOT build of the API - I think the current build should be pretty stable 😃