Initialize all fields of Static{Result|Exception}WaitHandle
commitf4bed8899ae5db0092ffaedc9873ef5ee9d87d7c
authorMike Magruder <mikemag@fb.com>
Wed, 3 Jul 2013 01:19:52 +0000 (2 18:19 -0700)
committerSara Golemon <sgolemon@fb.com>
Sat, 6 Jul 2013 18:12:22 +0000 (6 11:12 -0700)
treed70f47533ed28faf61c4514341c8ae208dc1ef79
parentfd5d218e8e7df49c1b1fec72cf69fc445855c206
Initialize all fields of Static{Result|Exception}WaitHandle

We force users to use the create() methods of StaticResultWaitHandle and StaticExceptionWaitHandle, which properly set m_resultOrException. However, deserialization will use the normal constructor which was failing to initialize the field. The destructor, then, would operate on random data. This broke hphpd when a stack trace had one of these objects on it somewhere. The 'where' command would succeed, but the next command (which deletes the stack trace), would segfault in the wait handle's destructor.

I think it's fair to not serialize this member. It's not exposed thru PHP except via joining with the wait handle, and I think an argument can be made that it's just plain wrong to join with a deserialized copy of a wait handle. So I've just initialized it to a reasonable default.
hphp/runtime/ext/asio/static_exception_wait_handle.cpp
hphp/runtime/ext/asio/wait_handle.cpp
hphp/test/quick/continuation_serialize.php [new file with mode: 0644]
hphp/test/quick/continuation_serialize.php.expectf [new file with mode: 0644]