[ 
https://issues.apache.org/jira/browse/TINKERPOP-1442?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15488435#comment-15488435
 ] 

stephen mallette commented on TINKERPOP-1442:
---------------------------------------------

Tried several different approaches to solving this - each were valiant attempts 
- but ultimately there's no perfect way to do this and we end up with the Graph 
implementation stuck with the having to clean up it's own open transactions. 
The problem is that a session must maintain a single thread associated with it. 
If you interrupt that thread in doing its work then you orphan the transaction 
because you can't then issue more work in that thread to rollback incomplete 
transactions. Perhaps this is another reason to decouple thread interruption 
from traversal interruption, however, thread interruption still seems like a 
necessary approach to killing the session because a script may have nothing to 
do with "traversal interruption". You may just be trying to break out of a 
{{Thread.sleep()}}. 

Anyway, I've at least got this setup so that you can issue a "close" on a 
session and if there's a job blocking it will attempt to kill it - that's more 
than what we had before. In this way, that session thread won't run into 
oblivion on close waiting for a timeout to trigger. The timeout could be quite 
high in some cases (like for an OLAP traversal for example) and if enough of 
those hung around it wouldn't be healthy for the server.

I was able to make the change without breaks and no new additions to the 
protocol. Running tests and then will issue PRs.

> Killing session should make better attempt to cleanup
> -----------------------------------------------------
>
>                 Key: TINKERPOP-1442
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1442
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 3.1.4
>            Reporter: stephen mallette
>            Assignee: stephen mallette
>             Fix For: 3.1.5
>
>
> When a session is killed it tries to rollback transactions prior to ending 
> the session. If there is a long-run script (or perhaps a queue of jobs) then 
> this close job just gets added to the queue. If that rollback job never 
> executes then the transaction gets orphaned. 
> Graph implementations tend to have their own methods for cleaning up these 
> lingering transactions, but it would be better if the shutdown could occur in 
> an orderly fashion.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to