Update pitchfork master_pid regex to avoid self-reference shell pid#306
Open
dobon wants to merge 1 commit intodiscourse:mainfrom
Open
Update pitchfork master_pid regex to avoid self-reference shell pid#306dobon wants to merge 1 commit intodiscourse:mainfrom
dobon wants to merge 1 commit intodiscourse:mainfrom
Conversation
``` root@07d212411142-app:/var/www/discourse# pgrep -f "pitchfork monitor" 30864 root@07d212411142-app:/var/www/discourse# rails c Loading production environment (Rails 8.0.4) discourse(prod)> `pgrep -af "pitchfork monitor"` => "11035 sh -c pgrep -af \"pitchfork monitor\"\n30864 pitchfork monitor - \n" discourse(prod)> `pgrep -f "pitchfork monitor"`.strip.to_i => 12545 ``` The current regex is getting the pid of the pgrep shell command, rather than the actual pitchfork monitor. Using ^ anchor avoids this problem.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I ran into an error about insufficient workers while trying to run the updater and upon investigation I found an apparent bug with the updater script/pitchfork adapter. The following snippet illustrates the problem:
The current regex is getting the pid of the pgrep shell command, rather than the actual pitchfork monitor (which gives the wrong master_pid, which means that no workers can be found belonging to that master_pid, which causes the updater script to fail). Using ^ anchor in the pgrep command avoids this problem.