Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

throw_bad_optional_access in HttpConnectionManager #5289

Closed
alyssawilk opened this issue Dec 13, 2018 · 0 comments
Closed

throw_bad_optional_access in HttpConnectionManager #5289

alyssawilk opened this issue Dec 13, 2018 · 0 comments
Assignees
Labels
Milestone

Comments

@alyssawilk
Copy link
Contributor

As reported by @tonya11en

At Lyft, we've observed an Envoy crash with the following stack trace on build 6d9de10:

Backtrace:
#0 0x00007f05ab87ac37 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#0 0x00007f05ab87ac37 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1 0x00007f05ab87e028 in __GI_abort () at abort.c:89
#2 0x0000000000bd711d in __gnu_cxx::__verbose_terminate_handler() ()
#3 0x0000000000ba3df6 in __cxxabiv1::__terminate(void ()()) ()
#4 0x0000000000ba3e31 in std::terminate() ()
#5 0x0000000000ba52a8 in __cxa_throw ()
#6 0x0000000000b80ea7 in absl::optional_internal::throw_bad_optional_access() ()
#7 0x00000000007100af in value (this=) at external/com_google_absl/absl/types/optional.h:844
#8 Envoy::Http::ConnectionManagerImpl::ActiveStream::createFilterChain (this=this@entry=0x3cbd2000) at external/envoy/source/common/http/conn_manager_impl.cc:1408
#9 0x000000000071559b in createFilterChain (this=0x3cbd2000) at external/envoy/source/common/http/conn_manager_impl.cc:1001
#10 Envoy::Http::ConnectionManagerImpl::ActiveStream::sendLocalReply(bool, Envoy::Http::Code, std::string const&, std::function<void (Envoy::Http::HeaderMap&)> const&, bool, absl::optionalEnvoy::Grpc::Status::GrpcStatus) (this=this@entry=0x3cbd2000, is_grpc_request=is_grpc_request@entry=false, code=code@entry=Envoy::Http::UpgradeRequired, body=..., modify_headers=..., is_head_request=is_head_request@entry=false, grpc_status=...) at external/envoy/source/common/http/conn_manager_impl.cc:1002
#11 0x000000000071ab1b in Envoy::Http::ConnectionManagerImpl::ActiveStream::decodeHeaders(std::unique_ptr<Envoy::Http::HeaderMap, std::default_deleteEnvoy::Http::HeaderMap >&&, bool) (this=0x3cbd2000, headers=, end_stream=true) at external/envoy/source/common/http/conn_manager_impl.cc:573
#12 0x000000000074154a in Envoy::Http::Http1::ServerConnectionImpl::onMessageComplete (this=0x4398b40) at external/envoy/source/common/http/http1/codec_impl.cc:623
#13 0x0000000000744afc in Envoy::Http::Http1::ConnectionImpl::onMessageCompleteBase (this=0x4398b48) at external/envoy/source/common/http/http1/codec_impl.cc:442
#14 0x0000000000744bbd in operator() (__closure=0x0, parser=) at external/envoy/source/common/http/http1/codec_impl.cc:294
#15 Envoy::Http::Http1::ConnectionImpl::<lambda(http_parser
)>::_FUN(http_parser ) () at external/envoy/source/common/http/http1/codec_impl.cc:296
#16 0x0000000000747a9f in http_parser_execute ()
#17 0x00000000007427c2 in Envoy::Http::Http1::ConnectionImpl::dispatchSlice (this=this@entry=0x4398b48, slice=, len=) at external/envoy/source/common/http/http1/codec_impl.cc:378
#18 0x00000000007445b3 in Envoy::Http::Http1::ConnectionImpl::dispatch (this=0x4398b48, data=...) at external/envoy/source/common/http/http1/codec_impl.cc:363
#19 0x0000000000717988 in Envoy::Http::ConnectionManagerImpl::onData (this=0x156381c0, data=...) at external/envoy/source/common/http/conn_manager_impl.cc:230
#20 0x00000000005f30e7 in Envoy::Network::FilterManagerImpl::onContinueReading (this=this@entry=0x29ad8018, filter=filter@entry=0x0) at external/envoy/source/common/network/filter_manager_impl.cc:60
#21 0x00000000005f31bc in Envoy::Network::FilterManagerImpl::onRead (this=this@entry=0x29ad8018) at external/envoy/source/common/network/filter_manager_impl.cc:70
#22 0x00000000005f041f in onRead (read_buffer_size=205, this=0x29ad8000) at external/envoy/source/common/network/connection_impl.cc:263
#23 Envoy::Network::ConnectionImpl::onReadReady (this=this@entry=0x29ad8000) at external/envoy/source/common/network/connection_impl.cc:496
#24 0x00000000005f0c6e in Envoy::Network::ConnectionImpl::onFileEvent (this=0x29ad8000, events=3) at external/envoy/source/common/network/connection_impl.cc:472
#25 0x00000000005ea7f8 in operator() (__args#0=3, this=) at /usr/include/c++/5/functional:2267
#26 operator() (__closure=0x0, arg=, what=) at external/envoy/source/common/event/file_event_impl.cc:60
#27 Envoy::Event::FileEventImpl::<lambda(int, short int, void
)>::_FUN(int, short, void ) () at external/envoy/source/common/event/file_event_impl.cc:61
#28 0x00000000008b9cef in event_persist_closure (ev=, base=0x2456dc0) at ../event.c:1580
#29 event_process_active_single_queue (base=base@entry=0x2456dc0, max_to_process=max_to_process@entry=2147483647, endtime=endtime@entry=0x0, activeq=) at ../event.c:1639
#30 0x00000000008ba41f in event_process_active (base=base@entry=0x2456dc0) at ../event.c:1738
#31 0x00000000008bd178 in event_base_loop (base=0x2456dc0, flags=) at ../event.c:1961
#32 0x00000000005e66b6 in Envoy::Server::WorkerImpl::threadRoutine (this=0x2edecc0, guard_dog=...) at external/envoy/source/server/worker_impl.cc:101
#33 0x00000000008cabe5 in Envoy::Thread::ThreadImpl::ThreadImpl(std::function<void ()>)::{lambda(void
)#1}::_FUN(void*) () at /usr/include/c++/5/functional:2267
#34 0x00007f05abf1b184 in start_thread (arg=0x7f05a8c79700) at pthread_create.c:312
#35 0x00007f05ab94203d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
This is due to the usage of std:optional::value() to check whether an optional variable has a value instead of std::optional::has_value(). value() throws an exception if has_value() would return false, so I suspect the intention is what can be found in this PR.

Please let me know if I'm misunderstanding something.

Risk Level:
Low

Testing:
Existing UTs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants