Level / party

Open a leveldb handle multiple times.
MIT License
146 stars 13 forks source link

Cannot successfully access same database with two different system users #13

Open medikoo opened 8 years ago

medikoo commented 8 years ago

If, when logged in as user A, I initialize database, and then when I try to connect to same database using user B, no data is propagated, and no error (that would indicate that something went wrong) is exposed.

How to reproduce:

Try to run below code on database initiated by other user. No logs will be reported, as if operation hanged. Same code will run as expected when run by user which initialized first access.

'use strict';

var level = require('level-party');
var db = level(pathToLevelDbFolder);

var stream = db.createReadStream();
stream.on('data', function () {});
stream.once('error', function (err) {
    console.log("Error", err.stack);
});
stream.once('end', function () {
    console.log("End");
});
vweevers commented 4 years ago

Which platform?

theprojectsomething commented 3 years ago

Can confirm same issue on node 15.2.1 / ubuntu server 20.04.1. No errors. Switching level-party for level gives the standard LOCK error

theprojectsomething commented 3 years ago

Actually it looks like a permissions error, specifically:

Error [OpenError]: IO error: /{path}/LOCK: Permission denied

My scenario is a node script running as a service (webserver) ... this creates and updates the original database (as root). All DB files are created with 0644 permissions. I am then attempting access as another user (for manual checkup / data dump). Sudoing the user script works as expected.

If the db is initially created by the non-root user, everything works as expected.

theprojectsomething commented 2 years ago

@vweevers any suggestions here? This is still an issue for us .. assume we can manually chown to a group after creation but is same possible with LOCK files?