-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix long messages to stdout/stderr getting truncated #1076
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems definitively uggly and not robust...
Need a better solution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, use sizeof() or strlen() for litterals , it is more understandable than a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About robustness, if sometime in the future we change the prefix format in the child part, we will have to update the parent side...
Need to find a robust solution to know a length of this prefix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's your suggestion then, @remicollet? I poked around for a while but there was no obvious simple way. We could reduce
FPM_LOG_BUFFER
; alternatively, the "child said into" stuff could be printed on its own line before the actual message. Or parse the line usingsscanf()
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should note that the "WARNING: " and date/time prefixes (for which the lengths are calculated) are not from the child message, @remicollet. They are added by the zlog call.
Another alternative would be to completely remove the line wrapping logic here (and maybe elsewhere, haven't looked), remove the length terminator logic ("..." and cut-off) from zlog, and wrap longer lines entirely in zlog instead. Would that be better? /cc @jpauli @Tyrael
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I know, I'm just mentioning that picking the 1024 limit can be deliberate and we should be careful if we wan't to remove that. how would your proposed solution for allowing error messages longer than 1024 bytes work when error_log is set to "syslog" for fpm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well this issue right now is only in
fpm_stdio_child_said
, which callszlog
, and that's responsible for either writing to syslog, or to a file. Right now,zlog
cuts off any long messages using "...", but it could just as well split at 1024 characters and write those chunks separately, no?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, what do we do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Tyrael just reading this again and realised that it doesn't really makes much sense today as 1024 (that is specified in RFC3164) limit was obsoleted by RFC5424 where there is no such limit. So this reason should no longer be valid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually old syslogd and things like papertrail still has got that limit but rsyslog for example can handle that. Anyway I don't think we should have such strict limitation.