Commit 3605d9f
wangle/service:ServiceTest: fix ASAN test
Summary:
```
☢ wangle/service:ServiceTest - Wangle.ClientServerTest 1.799s (FATAL)
Failed to find test summary. This test binary may have crashed mid-run. Full output follows:
Note: Google Test filter = Wangle.ClientServerTest
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from Wangle
[ RUN ] Wangle.ClientServerTest
=================================================================
==2396362==ERROR: AddressSanitizer: heap-use-after-free on address 0x611000000568 at pc 0x000000481dfc bp 0x7fff7d9c2eb0 sp 0x7fff7d9c2ea8
=== How to use this, how to get the raw stack trace, and more: fburl.com/ASAN ===
W0812 19:22:04.903192 2396422 HandlerContext-inl.h:177] readEOF reached end of pipeline
READ of size 8 at 0x611000000568 thread T0
#2 wangle/channel/Pipeline-inl.h:72 wangle::PipelineBase& wangle::PipelineBase::removeHelper<...>(wangle::ClientDispatcherBase<...>*, bool)
#3 wangle/channel/Pipeline-inl.h:97 wangle::PipelineBase& wangle::PipelineBase::remove<...>(wangle::ClientDispatcherBase<...>*)
#4 wangle/service/ClientDispatcher.h:27 wangle::ClientDispatcherBase<...>::~ClientDispatcherBase()
#5 wangle/service/ClientDispatcher.h:63 wangle::SerialClientDispatcher<...>::~SerialClientDispatcher()
#6 wangle/service/ServiceTest.cpp:89 wangle::ClientServiceFactory<...>::ClientService::~ClientService()
#13 folly/Traits.h:279 std::shared_ptr<...>::~shared_ptr()
#14 wangle/service/ServiceTest.cpp:135 wangle::Wangle_ClientServerTest_Test::TestBody()
#25 common/gtest/LightMain.cpp:9 main
0x611000000568 is located 40 bytes inside of 200-byte region [0x611000000540,0x611000000608)
freed by thread T0 here:
#0 ServiceTest+0x59d790 operator delete(void*)
#1 wangle/channel/Pipeline-inl.h:26 wangle::Pipeline<...>::~Pipeline()
#6 folly/Traits.h:279 std::shared_ptr<...>::~shared_ptr()
#7 wangle/bootstrap/BaseClientBootstrap.h:31 wangle::BaseClientBootstrap<...>::~BaseClientBootstrap()
#8 wangle/bootstrap/ClientBootstrap.h:100 wangle::ClientBootstrap<...>::~ClientBootstrap()
#16 wangle/service/ServiceTest.cpp:134 wangle::Wangle_ClientServerTest_Test::TestBody()
#27 common/gtest/LightMain.cpp:9 main
previously allocated by thread T0 here:
#0 ServiceTest+0x59d150 operator new(unsigned long)
#1 wangle/channel/Pipeline.h:167 wangle::Pipeline<...>::create()
#2 wangle/service/ServiceTest.cpp:77 wangle::ClientPipelineFactory<...>::newPipeline(std::shared_ptr<...>)
#3 wangle/bootstrap/BaseClientBootstrap.h:59 wangle::BaseClientBootstrap<...>::makePipeline(std::shared_ptr<...>)
#4 wangle/bootstrap/ClientBootstrap.h:94 wangle::ClientBootstrap<...>::connect(folly::SocketAddress const&, std::chrono::duration<...>)::{lambda()#1}::operator()() const
#5 folly/Function.h:290 void folly::detail::function::FunctionTraits<...>::callSmall<...>(folly::detail::function::Data&)
#6 folly/async/EventBase.cpp:629 folly::detail::function::FunctionTraits<...>::operator()()
#8 wangle/bootstrap/ClientBootstrap.h:76 wangle::ClientBootstrap<...>::connect(folly::SocketAddress const&, std::chrono::duration<...>)
#9 wangle/service/ServiceTest.cpp:123 wangle::Wangle_ClientServerTest_Test::TestBody()
#20 common/gtest/LightMain.cpp:9 main
: AddressSanitizer: heap-use-after-free third-party-buck/gcc-4.9-glibc-2.20-fb/build/libgcc/include/c++/trunk/bits/stl_vector.h:267 in std::vector<std::shared_ptr<wangle::PipelineContext>, std::allocator<std::shared_ptr<wangle::PipelineContext> > >::_M_is_valid() const
Shadow bytes around the buggy address:
0x0c227fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c227fff8060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c227fff8070: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c227fff8080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c227fff8090: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c227fff80a0: fa fa fa fa fa fa fa fa fd fd fd fd fd[fd]fd fd
0x0c227fff80b0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c227fff80c0: fd fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c227fff80d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c227fff80e0: 00 00 00 00 00 00 00 00 00 fa fa fa fa fa fa fa
0x0c227fff80f0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap right redzone: fb
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==2396362==ABORTING
✓ wangle/service:ServiceTest - main 0.000s (PASS)
Summary (total time 1.91s):
PASS: 9
FAIL: 0
SKIP: 0
FATAL: 1
wangle/service:ServiceTest - Wangle.ClientServerTest
TIMEOUT: 0
OMIT: 0
```
Differential Revision: D3714069
fbshipit-source-id: 178f11795a12742c5b2eee5179375c250758daba1 parent 92d89a4 commit 3605d9f
1 file changed
+0
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
135 | 134 | | |
136 | 135 | | |
137 | 136 | | |
| |||
0 commit comments