Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: startup permission check #421

Merged
merged 2 commits into from
Jun 30, 2022
Merged

feat: startup permission check #421

merged 2 commits into from
Jun 30, 2022

Conversation

koivunej
Copy link
Contributor

When running with data directory which is not writeable (but still might contain writable database files), this gives:

INFO 🏁 Starting node. version="v0.2.3-alpha-38-gf719abe"
Error: Failed to create a file in /.../tmpdir. Make sure the directory is writable by the user running pathfinder.

Caused by:
    Permission denied (os error 13)

This check might of course cause issues for some users but helping these out are always confusing, especially if the error comes from sqlite because a journal file couldn't be removed or created or whatever.

Copy link
Contributor

@Mirko-von-Leipzig Mirko-von-Leipzig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it. I wonder if we can similarly check the database file(s) permissions somehow (if they exist of course)?

@koivunej
Copy link
Contributor Author

I like it. I wonder if we can similarly check the database file(s) permissions somehow (if they exist of course)?

Looked at more options yesterday.

Trouble with looking at the os specific permissions, it's more difficult to resolve if we are the owner, are in group or others or have acl

Trouble looking at the sqlite open options, the read_write allows write being missing according to docs.

I think for practical ways this leaves the option of doing any write. I've previously suggested we should track sessions and up until which block have they gotten in a sort of audit table which could also be used for repairs (if we'd know that version X processed until block Y ...). I wouldn't want to continue an audit table on this.

One thing I was left thinking that this check might of course hurt someone... Any objection to me adding skip with std::env::var_os("PATHFINDER_SKIP_PERMISSION_CHECK").is_some()? @Mirko-von-Leipzig @kkovaacs

@kkovaacs
Copy link
Contributor

One thing I was left thinking that this check might of course hurt someone...

Hmm, how? I think testing that new files can be created in the data directory is actually good: sqlite creates new files in that directory, so not having the permission to do so would be just bad.

@Mirko-von-Leipzig
Copy link
Contributor

One thing I was left thinking that this check might of course hurt someone...

I think lets wait until that actually happens? I.. can't think of any good scenario where we can only read from the existing read-only database. I guess maybe in the future they somehow want to server a read-only snapshot with sync and everything else disabled? But they can then ask for that (weird) feature.

@koivunej
Copy link
Contributor Author

Oki, I just have a bad track record with adding features which seemingly do no harm but were hurting docker users :)

@Mirko-von-Leipzig
Copy link
Contributor

Oki, I just have a bad track record with adding features which seemingly do no harm but were hurting docker users :)

Lets run it in docker before then just to make sure :)

Joonas Koivunen added 2 commits June 30, 2022 16:25
sounds trivial but the permissions are 99% of support requests related
to running docker. sqlite will give out xDelete on VFS object related
error if everything goes well up until for example the journal file
needs to be removed or created (due to some interesting configuration).
@koivunej koivunej requested a review from a team as a code owner June 30, 2022 13:25
@koivunej koivunej merged commit 3d2d1fb into main Jun 30, 2022
@koivunej koivunej deleted the permission_check branch June 30, 2022 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants