party icon indicating copy to clipboard operation
party copied to clipboard

Cannot successfully access same database with two different system users

Open medikoo opened this issue 10 years ago • 4 comments

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");
});

medikoo avatar Feb 15 '16 19:02 medikoo

Which platform?

vweevers avatar Dec 08 '19 16:12 vweevers

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 avatar Jan 27 '21 01:01 theprojectsomething

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 avatar Jan 27 '21 02:01 theprojectsomething

@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?

theprojectsomething avatar Oct 26 '21 00:10 theprojectsomething