-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
[JENKINS-73090] Handle CR from LineTransformationOutputStream
#9219
[JENKINS-73090] Handle CR from LineTransformationOutputStream
#9219
Conversation
…neTransformationOutputStream-JENKINS-73090
#3580 👀 |
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 think this makes sense. It is quite awkward right now that LineTransformationOutputStream
has different behavior to most other Java line-based APIs like BufferedReader.readLine
and Files.readAllLines
(makes it difficult to use these APIs together for things like reading log files).
I do wonder about potential performance impact. It might also be worth running the PCT to get an idea in advance of how many tests might be affected, if any.
Any particular concerns?
Good point, I can do that in |
My worry is just that this is inner loop code that looks at every byte that gets written to a build log, so it seems possible that even the small changes here which add a field lookup and some branches could have measurable impact at scale. We don't have benchmarks to measure against though, and maybe JIT compilation, branch prediction, and out-of-order execution will make it a nonissue. Either way, unless the performance impact is massive (which I doubt), I think the change is probably worth it. |
Indeed it is. On the other hand it is already calling In the particular case being fixed here, that of a large block of text separated by CR, this is not just a performance improvement but potentially necessary to avoid OOME. Presumably that case is unusual and most text is NL-delimited or occasionally CRNL. |
This PR is now ready for merge. We will merge it after approximately 24 hours if there is no negative feedback. /label ready-for-merge |
See JENKINS-73090 for background.
Testing done
Without the fix, the
cr
test with the count set to a billion failed with(I am not leaving this count that high in the committed test since when it passes it takes over two minutes of high CPU on my laptop.)
I also tried installing the Timestamper plugin, enabling the global decorator (auto timestamps in all Pipeline builds), and running the Windows
git clone
pipeline mentioned in Jira. This produced timestamped output, though the output did seem to come all at once, though that seemed to be an aspect of Git not Jenkins so far as I could tell from looking at thejenkins.log
file in the workspace temp dir; so I also triedwhich did produce live timestamped output, though the classic console does not reliably show it; Pipeline Graph View plugin does. (
tail -f …/builds/…/log
from a terminal actually updates the line in place.)Proposed changelog entries
Proposed upgrade guidelines
N/A
Before the changes are marked as
ready-for-merge
:Maintainer checklist