The current interrupt implementation is failing on Sqlg's HSQLDB implementation. The reason for this is that HSQLDB itself relies on Thread.interrupt() for its own internal logic. When TinkerPop interrupts the thread it thinks it has to do with its own logic and as a result the interrupt flag is reset and no exception is thrown.
Reading the Thread.interrupt javadocs it says that wait(), join() and sleep() will all reset the interrupt flag throw an InterruptedException. This makes TinkerPop's reliance on the flag being set somewhat fragile. All of those methods I suspect are common with database io code and TinkerPop being a high level database layer makes it susceptible to 3rd party interpretations of interrupt semantics. In some ways the TraversalInterruptionTest itself had to carefully reset the flag with its usage of Thread.sleep(). My proposal is to mark the traversal itself as interrupted rather than the thread and keep the logic contained to TinkerPop's space. Another benefit is that the traversal.interrupt() can raise an event that implementations can listen to. On receipt of the event they would then be able to send a separate request to the database to cancel a particular query. In my case would be a nice way for Sqlg to tell Postgresql or HSQLDB to cancel a particular query (the latest one the traversal executed). In many ways the semantics are the same. Currently for client code wanting to interrupt a particular traversal it needs to have a reference to the thread the traversal is executing in. Now instead it needs to keep a reference to executing traversals and interrupt them directly. Add Traversal.interrupt() and Traversal.isInterrupted(boolean ClearInterrupted) Caveat, I am not familiar with GremlinServer nor the complications around interrupt there so perhaps I am missing something. Thanks Pieter