Need DestructorGuard in HQSession::handleWriteError(HQStreamTransportBase* hqStream, quic::QuicErrorCode err)?
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 1.5k
- Avg merge
- 10m
- Merged PRs (30d)
- 2
Description
Hi, our codebase uses proxygen and recently we saw a crash inside the proxygen HTTPTransaction/HQSession stack. It looks like the underlying txn object was gone inside the dguards destructor.
Could it be that there should be a DestructorGuard in the method `HQSession::handleWriteError` as well? The comment also seems to suggest similar concern.
https://github.com/facebook/proxygen/blob/f9652e5b307a5c9eec245a5ab1ca97494823b165/proxygen/lib/http/session/HQSession.cpp#L1967-L1973
While this crash is not easily reproducible as this is our first time seeing it, I wonder what the thoughts are from the team. Thanks.
Core dump after crash:
```
* thread #1, name = '', stop reason = signal SIGSEGV: address not mapped to object
* frame #0: 0x0000000001831c13 `folly::DelayedDestructionBase::DestructorGuard::~DestructorGuard(this=) at DelayedDestructionBase.h:94:16
frame #1: 0x00000000019026e8 `proxygen::HTTPTransaction::processIngressError(this=, error=) at HTTPTransaction.cpp:762:1
frame #2: 0x000000000194a451 `proxygen::HQSession::handleWriteError(proxygen::HQSession::HQStreamTransportBase*, quic::QuicErrorCode) [inlined] proxygen::HQSession::HQStreamTransportBase::errorOnTransaction(this=0x000000013d286628, ex=HTTPException @ 0x00007f54a7be1888) at HQSession.cpp:985:10
frame #3: 0x000000000194a42d `proxygen::HQSession::handleWriteError(this=, hqStream=, err=) at HQSession.cpp:1974:13
frame #4: 0x000000000193a5e5 `proxygen::HQSession::onStopSending(this=, id=, error=) at HQSession.cpp:268:5
frame #5: 0x0000000001a63fc1 `quic::QuicTransportBaseLite::handleStreamStopSendingCallbacks(this=) at QuicTransportBaseLite.cpp:1957:20
frame #6: 0x0000000001a62301 `quic::QuicTransportBaseLite::processCallbacksAfterNetworkData(this=) at QuicTransportBaseLite.cpp:1571:3
frame #7: 0x0000000001a5fc60 `quic::QuicTransportBaseLite::onNetworkData(this=, peer=, networkData=) at QuicTransportBaseLite.cpp:145:7
frame #8: 0x00000000019ceea7 `quic::QuicServerWorker::dispatchPacketData(folly::SocketAddress const&, quic::RoutingData&&, quic::NetworkData&&, folly::Optional, bool)::$_1::operator()(this=, transport=) const at QuicServerWorker.cpp:855:16
frame #9: 0x00000000019cd886 `quic::QuicServerWorker::dispatchPacketData(this=, client=, routingData=, networkData=, quicVersion=, isForwardedData=false) at QuicServerWorker.cpp:0
```
Contributor guide
Assessment
This issue has not been assessed yet.