Skip to content
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

Mitigate Interrupted system call on trace_file writes #5397

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

infinite-turtles
Copy link

Writes to files from bash built-ins like echo can be fallible, particularly in older versions of bash, such as versions 4.2.x and 4.4.x. This often lead to errors when running numerous processes with tracing enabled on network-based file systems, such as:

.command.run: line 172: echo: write error: Interrupted system call

Here is a potential mitigation. To address this, echo commands were consolidated into a single block to write to $trace_file with an error message on failure. This is assuming that the lack of a .command.trace file will not cause any downstream failures.

Reference

For more details on similar issues, see: https://unix.stackexchange.com/a/487260

Signed-off-by: Nico Holguin [email protected]

Copy link

netlify bot commented Oct 11, 2024

Deploy Preview for nextflow-docs-staging canceled.

Name Link
🔨 Latest commit 379299b
🔍 Latest deploy log https://app.netlify.com/sites/nextflow-docs-staging/deploys/670953991e7c9a00088e8547

…ove robustness

Echo commands were combined into a single block to write to $trace_file more efficiently, reducing the number of system calls. Added error handling to prevent tracing from causing workflow failures.

Signed-off-by: Nico Holguin <[email protected]>
echo "peak_rss=${nxf_stat_ret[5]}"
echo "vol_ctxt=${nxf_stat_ret[6]}"
echo "inv_ctxt=${nxf_stat_ret[7]}"
} >> "$trace_file" || >&2 echo "Error: Failed to append to file: $trace_file"
Copy link
Contributor

Choose a reason for hiding this comment

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

In functional term, I see the change correct, but not sure about the error message. If am not wrong, when running a command group in bash, the exit code of the group is the exit code of the last command. So, the error message will be printed only if the last echo command fails. Is this the intended behavior? I don't know if it will be a bit redundant

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.

2 participants