mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-06 02:25:23 +00:00
39a9977505
We've had multiple silent bugs stemming from the current double-init behavior of the logging system. To prevent that from happening for the fourth time, this CL makes all subsequent logging inits panic. This way, it will be much harder to commit code that won't work. Details: * Current behavior: only the first init applies logging configuration. The subsequent inits will silently do nothing, and discard the supplied settings. These settings could be important things like setting the log file, whether to echo to stderr, etc. * New behavior: after the first call to init, any subseqent call will panic. NOTE: If this CL breaks a downstream project, there is very likely a bug in that project which may be causing logs from crosvm to be lost. Please fix that bug, or revert this CL in the downstream project temporarily. In this CL, we discovered that openlog_and_get_socket (used in linux syslog) mutates global state. In tests, this manifested as a failure. For this CL, we've chosen to preserve the behavior of only re-creating State (and by extension, PlatformSyslog) when there is no STATE currently set. (This behavior is nice for other reasons since it keeps us from performing unnecessary operations when a no-op is possible.) BUG=b:238680255 TEST=presubmit & tested downstream by verifying log files were written. Also ran example_simple & verified it didn't panic. Change-Id: Iad64c1b52b917e63d14a42cbbd1739ef94107fae Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3756274 Commit-Queue: Noah Gold <nkgold@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-by: Vikram Auradkar <auradkar@google.com> |
||
---|---|---|
.. | ||
base_event_token_derive | ||
src | ||
.build_test_serial | ||
Cargo.toml |