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

ASF GitHub Bot commented on TINKERPOP-1761:
-------------------------------------------

GitHub user ko-mueller opened a pull request:

    https://github.com/apache/tinkerpop/pull/709

    TINKERPOP-1761: Cancel script evaluation timeout

    https://issues.apache.org/jira/browse/TINKERPOP-1761
    
    I basically added the code again which was wrongly removed in 
TINKERPOP-1714, plus added a test. All unit tests passed and I confirmed 
manually that this fixes the issue I experienced.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/ko-mueller/tinkerpop TINKERPOP-1761

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/tinkerpop/pull/709.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #709
    
----
commit 2a8c92f245aa28b66c616e62230bfd3972e7e5b9
Author: Konstantin Mueller <konstan...@mnemonic.no>
Date:   2017-09-11T09:25:12Z

    TINKERPOP-1761: Cancel script evaluation timeout in  when script evaluation 
finished.

----


> GremlinExecutor: Timeout future not cancelled on successful script evaluation
> -----------------------------------------------------------------------------
>
>                 Key: TINKERPOP-1761
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1761
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: groovy
>    Affects Versions: 3.2.6
>            Reporter: Konstantin Müller
>
> This bug seems to be introduced by TINKERPOP-1714. The timeout future in 
> GremlinExecutor.eval() is not cancelled when the evaluation future is 
> completed successfully before the timeout (lines 304ff). This was done 
> correctly before the changes introduced by TINKERPOP-1714. Code to reproduce:
> {code:java}
> try (GremlinExecutor executor = 
> GremlinExecutor.build().scriptEvaluationTimeout(15_000).create()) {
>   executor.eval("1+1").get();
> } catch (Exception e) {
>   // NOOP
> }
> {code}
> When the code leaves the try-block it calls GremlinExecutor.close() which 
> will clean up executorService and scheduledExecutorService, but because the 
> timeout future is not cancelled this will hang until the future is finished 
> (here 15s).
> Workaround: Provide an own ExecutorService when constructing a 
> GremlinExecutor instance and cancel all tasks when the script evaluation is 
> finished successfully.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to