Comments - Multi-threading and Statement.cancel()

10 years, 8 months ago Vladislav Vaintroub

Ok, I noticed one minor bug in cancel() implementation (I filed in CONJ-58 and fixed already). Basically, even if statement was not executed, active query on current connection was interrupted. This could describe your multithreading scenario. However, the fix is still not 100% bulletproof ('kill query' is not entirely deterministic), but it should behave a bit better.

 
10 years, 8 months ago Rich Stepanski

Cleaned up my test code. You were correct about the 'unknown thread' being from a closed connection. oops.

It sounds like you're describing what I'm hitting. Statement.cancel() on one thread interrupting a Statement.executeQuery() on a different Statement owned by a different thread.

I'll see if I can attach my test code. I do get different behavior based on the jdbc driver included. Seems like Connection wide cancellation vs Statement cancellation.

 
10 years, 8 months ago Vladislav Vaintroub

It is the only thing what server can do - connection wide cancellation with "kill query <connection>". Statement cancellation can only be emulated on client by checking if thus statement is being executed currently

 
10 years, 8 months ago Rich Stepanski

Fair enough. Thanks for your time.

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.