Skip to content

Fix logging race condition in 2 scripts#79

Merged
mwunderl merged 1 commit intofeature/non-interactivefrom
fix/logging-race-condition
Apr 30, 2026
Merged

Fix logging race condition in 2 scripts#79
mwunderl merged 1 commit intofeature/non-interactivefrom
fix/logging-race-condition

Conversation

@mwunderl
Copy link
Copy Markdown
Contributor

Two scripts had chmod after exec > >(tee ...), creating a race where chmod runs before tee creates the file.

Fix: touch + chmod before exec redirect.

Scripts fixed:

  • 049-aws-end-user-messaging-gs
  • 070-amazon-dynamodb-gs

Root cause: Process substitution >(tee -a "$LOG_FILE") creates the file asynchronously. chmod 600 "$LOG_FILE" on the next line can execute before the file exists, causing intermittent failures in Fargate.

@mwunderl mwunderl force-pushed the fix/logging-race-condition branch from 2cca6a3 to d44d444 Compare April 30, 2026 05:15
- 049, 070: chmod after exec > >(tee ...) races with file creation.
  Fix: touch + chmod before exec (070), simplify log setup (049).
- 049: set -e + exec > >(tee) causes SIGPIPE exit. Fix: drop set -e,
  script already has explicit error handling via check_error.
- 049: empty TEMP_FILES array triggers set -u. Fix: safe expansion.

Tested locally: both scripts create and clean up resources successfully.
@mwunderl mwunderl force-pushed the fix/logging-race-condition branch from d44d444 to 129a5a0 Compare April 30, 2026 06:11
@mwunderl mwunderl merged commit 16511c2 into feature/non-interactive Apr 30, 2026
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.

1 participant