Skip to content

Commit

Permalink
Merge pull request #6274 from chu11/issue6269_shell_redirect_warning
Browse files Browse the repository at this point in the history
shell: output stdio output size warning
  • Loading branch information
mergify[bot] authored Sep 10, 2024
2 parents aef4447 + 570b88e commit a3785a3
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/shell/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
#define SINGLEUSER_OUTPUT_LIMIT "1G"
#define MULTIUSER_OUTPUT_LIMIT "10M"
#define OUTPUT_LIMIT_MAX 1073741824
/* 104857600 = 100M */
#define OUTPUT_LIMIT_WARNING 104857600

enum {
FLUX_OUTPUT_TYPE_TERM = 1,
Expand Down Expand Up @@ -519,6 +521,24 @@ static void output_truncation_warning (struct shell_output *out)
out->stdout_bytes);
warned = true;
}
if (out->stderr_type == FLUX_OUTPUT_TYPE_KVS
&& (out->stderr_bytes > OUTPUT_LIMIT_WARNING
&& out->stderr_bytes <= OUTPUT_LIMIT_MAX)) {
shell_warn ("high stderr volume (%s), "
"consider redirecting to a file next time "
"(e.g. use --output=FILE)",
encode_size (out->stderr_bytes));
warned = true;
}
if (out->stdout_type == FLUX_OUTPUT_TYPE_KVS
&& (out->stdout_bytes > OUTPUT_LIMIT_WARNING
&& out->stdout_bytes <= OUTPUT_LIMIT_MAX)) {
shell_warn ("high stdout volume (%s), "
"consider redirecting to a file next time "
"(e.g. use --output=FILE)",
encode_size (out->stdout_bytes));
warned = true;
}
/* Ensure KVS output is flushed to eventlogger if a warning was issued:
*/
if (warned)
Expand Down

0 comments on commit a3785a3

Please sign in to comment.