Skip to content

fix(install): don't skip clickhouse steps when compose ps output is large - #4624

Merged
aldy505 merged 2 commits into
getsentry:masterfrom
pcbeingused33:fix/clickhouse-ps-grep-sigpipe
Nov 26, 2026
Merged

aldy505 merged 2 commits into
getsentry:masterfrom
pcbeingused33:fix/clickhouse-ps-grep-sigpipe

Conversation

@pcbeingused33

Copy link
Copy Markdown
Contributor

Fixes #4621

Cause: install/upgrade-clickhouse.sh and install/cleanup-clickhouse.sh detect an existing ClickHouse with $ps_command | grep -q clickhouse. grep -q exits at the first match, so the writer (compose ps) can get SIGPIPE; with set -o pipefail the pipeline then reports failure and the whole ClickHouse block is skipped without any message.

Fix: use grep clickhouse >/dev/null (as suggested in the issue) so grep reads all input before exiting.

Test: new _unit-test/clickhouse-ps-guard-test.sh stubs dc with a ps that prints ClickHouse first followed by a large amount of output, sources both scripts and checks that start_service_and_wait_ready clickhouse is reached. It fails before the change and passes after.

Scope: reproduces on upgrade (existing install with a ClickHouse container listed by compose ps); fresh installs have no ClickHouse container yet, so the block is skipped there by design.

Disclosure

This change was prepared with the help of an AI coding assistant (Claude Code); the submitter is responsible for it.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

…arge

`grep -q` exits on first match; under `set -o pipefail` the SIGPIPE sent
to `compose ps` makes the pipeline fail, so upgrade-clickhouse.sh and
cleanup-clickhouse.sh silently skipped their work. Drop -q and discard
grep's output instead.

Signed-off-by: Alex Castillo <alex.castillog33@gmail.com>

@aminvakil aminvakil left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for fixing this.
Please remove the tests and comments.

Signed-off-by: Alex Castillo <alex.castillog33@gmail.com>
@pcbeingused33

Copy link
Copy Markdown
Contributor Author

Thanks @aminvakil, removed the test and the comment in the latest push.

This comment was drafted with Claude Code.

@pcbeingused33

Copy link
Copy Markdown
Contributor Author

Hi @aminvakil, thanks for approving this. Is anything else needed before it can be merged? I'm happy to rebase or adjust if that helps.

@aminvakil

Copy link
Copy Markdown
Collaborator

Hi @pcbeingused333, PR is good AFAICS. It will get merged once a maintainer has time to review and merge this.

@aldy505 aldy505 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Apologies for the long wait. I'll get this merged today.

@aldy505
aldy505 enabled auto-merge (squash) November 26, 2026 13:27
@aldy505
aldy505 merged commit 29c0e11 into getsentry:master Nov 26, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

install.sh 26.11.0: ClickHouse upgrade/cleanup scripts are silently skipped (grep -q under pipefail makes docker compose ps -a exit 255)

3 participants