Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [rdf4j-dev] potential iterator leak in repository handling?

It may very well be that I don't understand how models initializes itself into a queryable state (it must use the repository interface no?).  Is the intent to load all models into a memorystore prior to use? If so, is that something rdf4j should do prior to using them since it has an opinion on the approach? 

Curious if lmdb is seeing the same issue and, if not, how does it handle it?

Btw- sry I initially responded with reply instead of replyall and didn't include the listserv. Correcting that here.

On Wednesday, April 5, 2023 at 06:56:57 AM EDT, Håvard Ottestad <hmottestad@xxxxxxxxx> wrote:


Models are meant to be simple, in-memory, data structures. I think it even implements the Java Set interface or something like that. 

The Sail and Repository interfaces are designed to handle the requirements for more advanced data sources like disk or network.

Håvard

On 5 Apr 2023, at 11:05, Matthew Nguyen <nguyenm9@xxxxxxx> wrote:


I realize you can check but 1) this is in the rdf4j code base so shouldn't it be cleaning up? and 2) if you're querying for triples, presumably they live in storage (or even remote), shouldn't it always be closeable (eg why do we treat model triple results differently?)

On Wednesday, April 5, 2023 at 04:58:00 AM EDT, Håvard Ottestad <hmottestad@xxxxxxxxx> wrote:


You can check if it implements the interface. 

Other than that the general rule of thumb is that if something is backed by disk or network then it should probably be closed in order to release system resources. Another case is where there is a dependency of some sorts, such as a lock that needs to be released. 

Håvard

On 5 Apr 2023, at 10:45, Matthew Nguyen <nguyenm9@xxxxxxx> wrote:


Should they be? If you are querying for triples, how or why do we differentiate whether the returned iterator is AutoCoseable or not?

On Wednesday, April 5, 2023 at 01:48:33 AM EDT, Håvard Ottestad <hmottestad@xxxxxxxxx> wrote:


I don’t think that iterators on models are AutoCloseable. 

Håvard

On 4 Apr 2023, at 22:36, Matthew Nguyen via rdf4j-dev <rdf4j-dev@xxxxxxxxxxx> wrote:


Hey folks,

Think there may be an iterator leak around repository handling.  Statements are pulled and filtered but not seeing how the returned iterator is ever closed.  Relevant code:

https://github.com/eclipse/rdf4j/blob/main/core/repository/api/src/main/java/org/eclipse/rdf4j/repository/config/RepositoryConfig.java#L155 
https://github.com/eclipse/rdf4j/blob/main/core/model/src/main/java/org/eclipse/rdf4j/model/util/Models.java#L97

Can someone more knowledgeable about this code comment?

thx, matt


_______________________________________________
rdf4j-dev mailing list
rdf4j-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/rdf4j-dev

Back to the top