I'm encountering a database locking issue when using ClassicLevel with the RAILGUN SDK in a Node.js backend service. The issue occurs during initialization or under concurrent request load. In some cases, the database hangs in 'opening' state
What I'm doing:
Using ClassicLevel as the database for startRailgunEngine.
Manually deleting and recreating the LevelDB directory on startup to avoid stale locks.
Awaiting levelDb.open() before passing it to startRailgunEngine.
Using a singleton instance of RailgunService.
Expected Behavior:
The DB should initialize without locking errors.
Concurrent requests should not interfere with the DB instance.
The engine should remain usable for all wallet-related operations.
Actual Behavior:
Under load or server restart, I encounter one or more of the following:
levelDb.status remains opening
LOCK file errors
RAILGUN SDK fails to initialize
Environment:
Node.js: v20.15.1
RAILGUN SDK: "@railgun-community/shared-models": "^7.6.2", "@railgun-community/wallet": "^10.4.0"
LevelDB: "classic-level": "^3.0.0",
OS: macOS
I'm encountering a database locking issue when using ClassicLevel with the
RAILGUN SDKin aNode.jsbackend service. The issue occurs during initialization or under concurrent request load. In some cases, the database hangs in'opening'stateWhat I'm doing:
Using ClassicLevel as the database for startRailgunEngine.
Manually deleting and recreating the LevelDB directory on startup to avoid stale locks.
Awaiting
levelDb.open()before passing it to startRailgunEngine.Using a singleton instance of RailgunService.
Expected Behavior:
The DB should initialize without locking errors.
Concurrent requests should not interfere with the DB instance.
The engine should remain usable for all wallet-related operations.
Actual Behavior:
Under load or server restart, I encounter one or more of the following:
levelDb.statusremains openingLOCK file errors
RAILGUN SDK fails to initialize
Environment:
Node.js:
v20.15.1RAILGUN SDK:
"@railgun-community/shared-models": "^7.6.2", "@railgun-community/wallet": "^10.4.0"LevelDB:
"classic-level": "^3.0.0",OS:
macOS