v8_context_snapshot_generator.cc should return a failure code for write failures instead of using CHECK |
||
Issue description
CHECK should be used for logic errors, not genuine runtime errors. This is true for build tools as well as for Chrome. In the worst case the use of a CHECK can, apparently, cause a build to succeed when it should fail, as shown below:
> ninja chrome -j 960 -l 48
[1 processes, 1/1 @ 0.3/s : 3.337s ] Regenerating ninja files
[960 processes, 2623/22981 @ 61.0/s : 42.994s ] CXX obj/media/filters/filters/ffmpeg_video_decoder.obj
wineserver: could not save registry branch to user.reg : Device or resource busy
[1 processes, 22961/22971 @ 54.3/s : 422.495s ] ACTION //tools/v8_context_snapshot:generate_v8_context_snapshot(//build/toolchain/win:win_clang_x64)
[0723/145133.979:FATAL:v8_context_snapshot_generator.cc(70)] Check failed: 0 < base::WriteFile(file_path, blob.data, blob.raw_size) (0 vs. -1)
Backtrace:
base::debug::StackTrace::StackTrace [0x00007FF6DB5C5404+36] (C:\src\chromium3\src\base\debug\stack_trace_win.cc:286)
logging::LogMessage::~LogMessage [0x00007FF6DB445ED5+101] (C:\src\chromium3\src\base\logging.cc:593)
main [0x00007FF6DA711155+341] (C:\src\chromium3\src\tools\v8_context_snapshot\v8_context_snapshot_generator.cc:72)
__scrt_common_main_seh [0x00007FF6DCB8EDE8+268] (f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283)
BaseThreadInitThunk [0x00007FFFA2CE1FE4+20]
RtlUserThreadStart [0x00007FFFA3D7CB31+33]
[1 processes, 22969/22969 @ 50.0/s : 459.503s ] STAMP obj/chrome/chrome.stamp
The CHECK failed, presumably due to having a test process open in a debugger, thus locking the file. A just-in-time debugger dialog popped up and a chose a Visual Studio instance to debug the crash. Already this is misleading because a crash implies a tool bug when in fact the problem was just a locked file.
After examining the failure in the debugger I closed the debugger and I *guess* the process exited with an error code of zero, meaning that the build continued, despite not having written the file!
,
Jul 27
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/a6e726f7d8e52afd627f036eba4b1798d9dbe278 commit a6e726f7d8e52afd627f036eba4b1798d9dbe278 Author: Bruce Dawson <brucedawson@chromium.org> Date: Fri Jul 27 20:55:24 2018 Get v8_context_snapshot_generator to exit(1) instead of crash Handling failures by crashing turns out to work poorly on Windows because it is confusing (it looks like a bug rather than a build failure) and because the process return code ends up being zero, so ninja doesn't realize anything is wrong. This change fixes these problems by detecting write failures and returning an error code. This particular CHECK is being fixed because it is easy to accidentally hit it simply by building Chrome while it is still running. The new error checking is also better in that it verifies that all Bug: 866656 Change-Id: I4303afaa898c85c72bd9d337fe8e19e239f17513 Reviewed-on: https://chromium-review.googlesource.com/1152159 Commit-Queue: Bruce Dawson <brucedawson@chromium.org> Reviewed-by: Kentaro Hara <haraken@chromium.org> Cr-Commit-Position: refs/heads/master@{#578770} [modify] https://crrev.com/a6e726f7d8e52afd627f036eba4b1798d9dbe278/tools/v8_context_snapshot/v8_context_snapshot_generator.cc
,
Jul 27
|
||
►
Sign in to add a comment |
||
Comment 1 by brucedaw...@chromium.org
, Jul 26