TupleQueryResult deadlocks within hasNext()

Description

I have used the while (nameResult.hasNext()) pattern as shown in [1] for close to a decade now,
but I have twice recently run into a situation where TupleQueryResult seems to deadlock within hasNext() when running as a MemoryStore in a webapp deployed via Tomcat.

I see in that "the user is responsible for properly closing a QueryResult", which I believe I do as per [1], shown below.

In this particular application, the error occurs during the "wrap up phase" of a crawl of about a 1,000 linked data requests. By this point, a handful of "what to crawl" queries had already been run, and a size query was also run for each linked data request. The TupleQueryResult deadlock only appears at the same point in the "wrap up phase", regardless of how large the preceding linked data crawl phase is.

In the prior application, the TupleQueryResult deadlock appeared against a simple <s> <p> ?o query against a graph of a few hundred triples, so the deadlock seems to not depend on graph size or number of prior queries.

In the logging shown below, a "before hasNext()" is the last message.

Any suggestions on how to break through to "free from hasNext()!" ?

Many thanks,
Tim Lebo

[1] http://rdf4j.org/sesame/2.8/docs/programming.docbook?view#section-repository-api3

Environment

Max OS X 10.11.2
Apache Tomcat 8.0.26 web application that depends on Sesame 2.8.8
Java 1.8.0_20-ea

Assignee

Jeen Broekstra

Reporter

Tim rdf

Labels

None

Components

Affects versions

Priority

Major
Configure