Skip to content

fix: Fix develop script pid tracking, improve logging and interrupt #5186

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

Merged
merged 2 commits into from
Nov 29, 2022

Conversation

mafredri
Copy link
Member

The previous refactor of the develop.sh script had an edge case and an incorrect assumption.

  • Due to sending multiple interrupts, including one to the process group (too early) we inadvertedly were interrupting the pg_ctl command started by builtin postgres during graceful shutdown, thus aborting DB shutdown whilst coder server exited gracefully
  • The assumption that command || fatal & would return the pid of command was incorrect, we were tracking the pid of the subshell (|| fatal).

We now start new processes on new filedescriptors to handle the logging > >(...) so that we can track the command pids appropriately.

We also only send interrupts to the actual pids (at first).

@mafredri mafredri self-assigned this Nov 29, 2022
@mafredri mafredri requested a review from a team November 29, 2022 12:26
_ = closeFunc()
cmd.Printf("Stopped built-in PostgreSQL\n")
if err := closeFunc(); err != nil {
cmd.Printf("Failed to stop built-in PostgreSQL: %v\n", err)
Copy link
Member Author

Choose a reason for hiding this comment

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

Review: Didn't catch this issue before now because we were ignoring errors.

Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

LGTM

@mafredri mafredri merged commit 085f191 into main Nov 29, 2022
@mafredri mafredri deleted the mafredri/fix-develop-script-again branch November 29, 2022 13:45
@github-actions github-actions bot locked and limited conversation to collaborators Nov 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants