{"record":{"id":"51872f09b8649ba6","repo":"linera-io/linera-protocol","slug":"store","errorCode":null,"errorMessage":"store","messagePattern":"store","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"linera-storage-service/src/server.rs","lineNumber":693,"sourceCode":"                statistics_level: Default::default(),\n            };\n            let storage_cache_config = StorageCacheConfig {\n                max_cache_size,\n                max_value_entry_size,\n                max_find_keys_entry_size,\n                max_find_key_values_entry_size,\n                max_cache_entries,\n                max_cache_value_size,\n                max_cache_find_keys_size,\n                max_cache_find_key_values_size,\n            };\n            let config = RocksDbStoreConfig {\n                inner_config,\n                storage_cache_config,\n            };\n            let database = RocksDbDatabase::maybe_create_and_connect(&config, &namespace)\n                .await\n                .expect(\"store\");\n            let store = database.open_shared(&[]).expect(\"Failed to open store\");\n            let store = LocalStore::RocksDb(store);\n            (store, endpoint)\n        }\n    };\n    let pending_big_puts = Arc::new(RwLock::new(BTreeMap::default()));\n    let pending_big_reads = Arc::new(RwLock::new(PendingBigReads::default()));\n    let store = StorageServer {\n        store,\n        pending_big_puts,\n        pending_big_reads,\n    };\n    let endpoint = endpoint.parse().unwrap();\n    info!(\"Starting linera_storage_service on endpoint={}\", endpoint);\n    Server::builder()\n        .add_service(StorageServiceServer::new(store))\n        .serve(endpoint)\n        .await","sourceCodeStart":675,"sourceCodeEnd":711,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-storage-service/src/server.rs#L675-L711","documentation":"`RocksDbDatabase::maybe_create_and_connect` opens (or creates) the RocksDB database at the configured --path and connects to the namespace. RocksDB takes an exclusive file lock (LOCK) on its directory, so a concurrent opener fails immediately; other failures are I/O errors (missing or unwritable directory, full disk) or namespace/option errors. The `.expect(\"store\")` in the storage server's main turns any Err into a startup panic, so the service never binds its endpoint.","triggerScenarios":"Launching `linera-storage-service rocksdb` twice with the same --path (the second instance hits RocksDB's LOCK and the PathWithGuard guard file); pointing --path at a read-only or non-existent directory; running out of disk while RocksDB creates its files.","commonSituations":"A previous server instance still running, or a crashed one leaving lock files behind; two test shards sharing a DB path; the path on a network filesystem where file locking is unreliable; a systemd restart racing a lingering old process.","solutions":["Check for another process holding the DB: `fuser -v <path>/LOCK` or `lsof +D <path>`; stop it, or give the second instance a different --path","Verify the directory exists and is writable by the service user (mkdir -p; chown/chmod)","Check disk space with `df -h` — RocksDB cannot create files on a full volume","Only after confirming no process is running, remove the stale <path>/LOCK and guard file, then retry"],"exampleFix":"# before: second server on the same DB path -> panic \"store\"\nlinera-storage-service rocksdb --path /data/linera  --endpoint 127.0.0.1:9111 &\nlinera-storage-service rocksdb --path /data/linera  --endpoint 127.0.0.1:9112  # panics\n\n# after: one instance per path\nlinera-storage-service rocksdb --path /data/linera-1 --endpoint 127.0.0.1:9111 &\nlinera-storage-service rocksdb --path /data/linera-2 --endpoint 127.0.0.1:9112","handlingStrategy":"validation","validationCode":"# before starting: is another instance already on this path?\nfuser /data/linera/LOCK 2>/dev/null && { echo \"DB in use - abort\"; exit 1; }\nmkdir -p /data/linera && [ -w /data/linera ] || { echo \"path not writable\"; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Give each storage-service instance its own --path; never share a RocksDB directory between processes","Add a pre-start check (fuser/lsof on the LOCK file) to service units and test harnesses","Ensure the service user owns the DB directory and the volume has free space"],"tags":["rocksdb","storage","database-lock","startup","rust"],"backgroundTag":"database-lock-conflict","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}