Fix stream/sink crash when RocketException doesn't have data
commitfe8bb1eb67cdec0380e004526cd51f043b296c07
authorAkrama Baig Mirza <akramam@meta.com>
Fri, 17 Feb 2023 20:17:42 +0000 (17 12:17 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Fri, 17 Feb 2023 20:17:42 +0000 (17 12:17 -0800)
treeed6737bacf4d2c243fa74f1b00c224fe0ee7570a
parentb80cb61d995397888eeec5516e5661dd59ab6a2f
Fix stream/sink crash when RocketException doesn't have data

Summary:
During RocketClient shutdown, we fail all sent requests and active stream/sinks with the `error_` stored in `RocketClient`: https://github.com/facebook/fbthrift/blob/main/thrift/lib/cpp2/transport/rocket/client/RocketClient.cpp#L1260-L1281

However, this `error_` could be a `RocketException` with an empty data buffer which causes a crash when propagated to active streams/sinks because that code path assumes that there is always data in the `RocketException`.

Reviewed By: maalbash

Differential Revision: D43365746

fbshipit-source-id: 2e0a9cb1aa13862a4dfa9d5ee7ab37b497e57a1c
third-party/thrift/src/thrift/lib/cpp2/async/ClientSinkBridge.cpp
third-party/thrift/src/thrift/lib/cpp2/async/tests/SinkServiceTest.cpp
third-party/thrift/src/thrift/lib/cpp2/async/tests/StreamServiceTest.cpp
third-party/thrift/src/thrift/lib/cpp2/transport/rocket/RocketException.h
third-party/thrift/src/thrift/lib/cpp2/transport/rocket/client/RocketStreamServerCallback.cpp