Exception thrown inside Base.show(::IO, x)
can cause an exception to leak a log message.
#56889
Labels
Base.show(::IO, x)
can cause an exception to leak a log message.
#56889
Julia has a nice feature built in to its logging package: An exception thrown while constructing a log message is captured and printed, rather than allowing it to throw, so that a bug in a log statement cannot break a process that would otherwise have succeeded without the log.
This is especially nice for allowing people to enable DEBUG logging without having to worry that it might cause unexpected crashes, since the debug-log-level is not often tested.
However, there is currently a gap: The try/catch is only around constructing the message, not printing it.
Consider these two examples:
This is because the try/catch is put around the construction of the message variable, but not while calling
Base.CoreLogging.handle_message
.Can we extend the try/catch to also wrap handle_message? Is there any reason we don't do this currently?
Thanks!
The text was updated successfully, but these errors were encountered: