Skip to content

LMDB read handles can remain exhausted after timed-out server queries #5807

@hmottestad

Description

@hmottestad

Problem

When many RDF4J Server queries against an LMDB repository time out, LMDB read handles can accumulate until the environment reaches MDB_READERS_FULL. After that, the repository may keep failing new reads even though only a small number of queries are running concurrently.

Observed stack trace starts at:

java.io.IOException: MDB_READERS_FULL: Environment maxreaders limit reached
	at org.eclipse.rdf4j.sail.lmdb.LmdbUtil.E(LmdbUtil.java:67)
	at org.eclipse.rdf4j.sail.lmdb.TxnManager.startReadTxn(TxnManager.java:65)
	at org.eclipse.rdf4j.sail.lmdb.TxnManager.createReadTxnInternal(TxnManager.java:152)
	at org.eclipse.rdf4j.sail.lmdb.TxnManager.createReadTxn(TxnManager.java:136)
	at org.eclipse.rdf4j.sail.lmdb.LmdbSailStore$LmdbSailDataset.<init>(LmdbSailStore.java:1105)

Reproducer

A Spring Boot RDF4J Server test reproduces this with default RDF4J LMDB settings by:

  • creating an LMDB repository through the server
  • loading a small dataset
  • sending many concurrent POST queries with short server-side timeout values
  • asserting that at least one query times out
  • asserting that no MDB_READERS_FULL or maxreaders failures are logged or returned
  • asserting that a later health query still succeeds

Expected

When LMDB reports MDB_READERS_FULL, RDF4J should close inactive/stale read transactions that no longer represent active query work, check for dead LMDB readers, retry the read transaction acquisition, and keep the repository usable.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions