Skip to content

fix(docker): use shell arithmetic for db ping timeout in server-wrapper (#4280) - #4366

Open
SAY-5 wants to merge 1 commit into
semaphoreui:developfrom
SAY-5:fix/server-wrapper-db-timeout
Open

SAY-5 wants to merge 1 commit into
semaphoreui:developfrom
SAY-5:fix/server-wrapper-db-timeout

Conversation

@SAY-5

@SAY-5 SAY-5 commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #4280.

The wrapper runs with set -e, and expr exits with status 1 when its result is 0, so on the last retry TIMEOUT=$(expr $TIMEOUT - 1) killed the script before the -eq 0 check could print "Could not connect to database server. Exiting." Using $((TIMEOUT - 1)) lets the loop reach the check. I ran the wrapper with a stubbed nc that always fails under sh and dash, and the error message now prints before the exit.

Summary by CodeRabbit

  • Chores
    • Updated deployment startup countdown handling. Database connection retry timing and connection-failure behavior remain unchanged, so there are no expected changes to the end-user experience.

…er (semaphoreui#4280)

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 379446af-b79b-448a-b072-305d40bb9691
Commits

Reviewing files that changed from the base of the PR and between d03a864 and 904c626.

Files selected for processing: 1
  • deployment/docker/server/server-wrapper

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

The server wrapper now decrements the database connection retry timeout with shell arithmetic expansion instead of expr. The timeout value and connection-failure behavior remain unchanged.

Changes: Database retry countdown

Layer / File(s) Summary
Timeout countdown
deployment/docker/server/server-wrapper
The retry loop decrements TIMEOUT with shell arithmetic expansion instead of invoking expr.

Priority: Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: tboerger

Merge Risk: Minimal · up to 904c6

The PR is limited to the database retry countdown and presents no established merge-blocking risk.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: replacing expr with shell arithmetic for the database ping timeout in server-wrapper.
Linked Issues check Passed The change addresses issue [#4280]. It replaces the expr timeout decrement in deployment/docker/server/server-wrapper with shell arithmetic. The wrapper can therefore reach the zero-timeout check …
Out of Scope Changes check Passed The pull request changes one timeout-decrement expression in the Docker server wrapper. The change directly supports issue [#4280]. The summary reports no unrelated declarations or behavior changes.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Full details: Linked Issues check

Explanation

The change addresses issue [#4280]. It replaces the expr timeout decrement in deployment/docker/server/server-wrapper with shell arithmetic. The wrapper can therefore reach the zero-timeout check under set -e and print Could not connect to database server. Exiting. after retries fail. The reported sh and dash tests support the required behavior.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The one-line change correctly prevents premature termination under set -e, with focused verification supporting the intended behavior.

No open issues 🎉

What changed in this PR

Fixes #4280 by allowing the Docker server wrapper to print its database connection timeout error before exiting.

Changes:

  • Replaces expr with POSIX shell arithmetic, preventing set -e from terminating the script when the countdown reaches zero.
  • Preserves the existing retry timing and timeout check.
File Description
deployment/​docker/​server/​server-wrapper Updates the timeout decrement so the database failure message is reached.

Review effort: Balanced

This branch has not been deployed

No deployments
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.

Problem: Docker server wrapper script exits on database connection failure without error message

2 participants