You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
close() does not release an open cursor or fact log: reopening the path fails with STG-025 #17
MiniGrafDb.close() documents that the path can be opened again right after it ("fine: the first handle is gone"). That does not hold when a cursor or a fact log from the handle is still open: each holds a core Snapshot, which keeps the storage, and with it the in-process registration and the file lock, alive until V8 collects the JS object.
Repro (v3 branch, core 5f2ba46e):
constdb=newMiniGrafDb(p)db.execute('(transact [[:a :n 1]])');db.checkpoint()constcursor=db.query('(query [:find ?e :where [?e :n _]])')// or db.factLog()db.close()newMiniGrafDb(p)// throws [STG-025] Database is already open in this process
The same happens with db.factLog(). Calling cursor.close() / log.close() first avoids it.
Possible fix: as #181 does for prepared queries, MiniGrafDb keeps weak references to its open cursors and fact logs, and close() releases them (later nextBatch returns null, as after the object's own close()). The C binding probably has the same gap and should be checked too.
Activity