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

important log messages may be truncated #6545

Closed
grondo opened this issue Jan 8, 2025 · 2 comments · Fixed by #6554
Closed

important log messages may be truncated #6545

grondo opened this issue Jan 8, 2025 · 2 comments · Fixed by #6554

Comments

@grondo
Copy link
Contributor

grondo commented Jan 8, 2025

Not sure where the truncation is occurring, but an important log message resulting from the following flux_log() call was truncated in flux dmesg :

            flux_log (hk->ctx->h,
                      LOG_ERR,
                      "housekeeping: %s (rank %s) from %s will be terminated"
                      " because %s",
                      hosts ? hosts : "?",
                      ranks ? ranks : "?",
                      idf58 (a->id),
                      error.text);

In this case >4000 nodes were affected, and the very long nodelist in hosts caused the log message to get truncated, suppressing the actual important bits of the message that sysadmins were searching for (e.g. the jobid).

@grondo
Copy link
Contributor Author

grondo commented Jan 14, 2025

This should have been obvious, but the internal flux log implementation has a fixed length (2K) buffer into which the stdlog messages are rendered. Since this includes other data besides just the log message itself, messages will be truncated well below 2K characters.

#define FLUX_MAX_LOGBUF 2048

typedef struct {
char appname[STDLOG_MAX_APPNAME + 1];
char procid[STDLOG_MAX_PROCID + 1];
char buf[FLUX_MAX_LOGBUF];
flux_log_f cb;
void *cb_arg;
} logctx_t;

Perhaps this fixed buffer was used to avoid memory allocations when OOM, though I'm guessing there's likely memory allocations if the log data is forwarded via messages or appended to the dmesg buffer?

@garlick
Copy link
Member

garlick commented Jan 14, 2025

Yeah I was proabably thinking about the scalability of a million nodes logging towards the root or some other imaginary thinking :-) No harm in detecting truncation and trying again with a malloc maybe? Then at least the common case won't abuse the heap.

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 a pull request may close this issue.

2 participants