-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Stacktraces larger than maxStringLength are not truncated #57
Comments
Thanks for the detailed bug report and solution path, @waldeinburg. I am able to reproduce the bug. I will release a fix in a couple of days. |
Using a dynamically growing buffer is not option, since 1) it will violate garbage-free semantics of the layout and 2) will cause the retain of the overflown buffers since they are recycled. That is why I have just capped the Note that the int writerCapacity = builder.maxStringLength > 0
? builder.maxStringLength
: builder.maxByteCount; There I bet that user is smart enough the provide a decent configuration. That said as I stated in #56, in the successor that will be contributed to Would you mind checking the fix, i.e., 521a463, and letting me know if it addresses your issue, please? |
The fix works, thanks! I understand now why we can't have a growing buffer, but I think the default value for maxStringLength should be reconsidered. Stack trace is the field most likely to fill up the buffer, so if the default was, e.g., 12288 (i.e., 3/4 of the buffer) you would keep the message under normal conditions. Sure, the user is smart ... but (IMHO) is also inclined to think that the defaults are safe and will probably not look out for buffer sizes when the logging does not include large fields apart from stack traces. |
Thanks for the prompt feedback @waldeinburg. I am closing the issue. Once you comment on the 2 other issues you have submitted (#55 and #56), I will make a new release for you. |
You're welcome! Thanks for the super quick feedback to you too! |
I've just released v1.0.2 including this fix. |
Thanks! I would wish all libraries replied this fast to issues! |
Stacktraces larger than
resolverContext.writerCapacity
causes anArrayIndexOutOfBoundsException
in the call toSystem::arraycopy
fromBufferedWriter::write
because it attempts to write past the end of the buffer. The message is lost.For stacktraces,
maxStringLength
has different semantics than for normal values: Instead of causing truncation, the buffer capacity is set frommaxStringLength
instead ofmaxByteCount
if set.The minimal solution would be that
BufferedWriter
detects if it is going to write past the buffer size and truncates.The ideal solution would be to truncate as described based on
maxStringLength
if set and also use a growable buffer to avoid message loss. You could use the same mechanism asByteArrayOutputStream
(c.f. the private methodgrow
) instead ofchar[]
.The text was updated successfully, but these errors were encountered: