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

macOS: clear runstate dir after instance stop #1450

Merged
merged 5 commits into from
Jan 29, 2025
Merged

Conversation

fantix
Copy link
Member

@fantix fantix commented Jan 23, 2025

Refs edgedb/edgedb#8248, #1418

Manually tested with the repro in #1418

@fantix fantix requested review from msullivan and mmastrac January 23, 2025 23:41
Copy link
Member

@msullivan msullivan left a comment

Choose a reason for hiding this comment

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

What goes in the runstate dir? When running the server locally in dev mode, the socket is in the postgres data dir, which would obviously be wrong here.

We're 100% sure this is safe?


// Clear the runstate dir - macOS wouldn't delete UNIX domain socket
// files after server shutdown, which may lead to issues in upgrades
fs::remove_dir_all(runstate_dir(name)?).ok();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should filter and remove only domain sockets if that is the problem. Something like this?

    for entry in fs::read_dir(dir_path)? {
        let entry = entry?;
        let path = entry.path();

        if let Ok(metadata) = path.metadata() {
            if metadata.file_type().is_socket() {
                fs::remove_file(&path)?;
            }
        }
    }

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup, that'll do! Do you mind pushing that to the PR? I'm kinda in the middle of home moving. Thank you!

@fantix fantix merged commit 16ab350 into master Jan 29, 2025
17 checks passed
@fantix fantix deleted the macos-clear-runstate branch January 29, 2025 20:13
@fantix
Copy link
Member Author

fantix commented Jan 29, 2025

Thank you all!

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