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

HeaderServerChannel throw uncaught exception. #237

Closed
supapo opened this issue Sep 27, 2017 · 3 comments
Closed

HeaderServerChannel throw uncaught exception. #237

supapo opened this issue Sep 27, 2017 · 3 comments
Assignees

Comments

@supapo
Copy link

supapo commented Sep 27, 2017

In case we listen with cpp2 , telneting to the server and drop some string the server will crash.

We solve it by comment out the "throw" on
thrift/lib/cpp2/async/HeaderServerChannel.cpp : 117

this is the log from the server:

E0927 12:53:02.924060 24848 HeaderServerChannel.cpp:114] Received invalid request from client: apache::thrift::transport::TTransportException: Header transport frame is too large: 1634952289 (hex 0x61736461, ascii 'asda') (transport apache::thrift::async::TAsyncSocket, address ::1, port 43276)
I0927 12:53:02.959806 24848 FramingHandler.cpp:47] Failed to read a message header
I0927 12:53:02.966233 24848 Cpp2Channel.cpp:160] Got a read error: apache::thrift::transport::TTransportException: Header transport frame is too large: 1634952289 (hex 0x61736461, ascii 'asda')
I0927 12:53:02.969139 24848 HeaderServerChannel.cpp:580] Receive error: apache::thrift::transport::TTransportException: Header transport frame is too large: 1634952289 (hex 0x61736461, ascii 'asda')
I0927 12:53:02.969233 24848 Cpp2Channel.cpp:198] Got an EOF on channel
I0927 12:53:03.076377 24848 Cpp2Channel.cpp:198] Got an EOF on channel

@eduardo-elizondo
Copy link
Contributor

@supapo This means that you are sending a malformed message. This is because when listening on cpp2 we are expecting an explicit formatted message. This is useful because this prevents you to process the data when you know right away that your message is corrupted. You should be using a cpp2 client to communicate with a cpp2 server. Otherwise, you will need to add a check in thrift to understand a telnet message.

@eduardo-elizondo eduardo-elizondo self-assigned this Sep 27, 2017
@supapo
Copy link
Author

supapo commented Sep 28, 2017

The crash occurs on a Duplex server only. When sending a random string.
in ExampleServer.cpp of the chat room sample I have added a line : chatroom_server->setDuplex( true );
as a client, I have typed random characters on the telnet command

the crash log on the server screen:

bin/example_server I0928 11:34:07.423589 15645 ExampleServer.cpp:35] ChatRoom Server running on port: 7777
I0928 11:34:07.423696 15645 ExampleServer.cpp:46] Echo Server running on port: 7778
E0928 11:34:21.987407 15697 HeaderServerChannel.cpp:114] Received invalid request from client: apache::thrift::transport::TTransportException: Header transport frame is too large: 1718117992 (hex 0x66686668, ascii 'fhfh') (transport apache::thrift::async::TAsyncSocket, address ::ffff:127.0.0.1, port 37080)
terminate called after throwing an instance of 'std::system_error'
what(): setFromSocket() failed: Bad file descriptor
*** Aborted at 1506587661 (Unix time, try 'date -d @1506587661') ***
*** Signal 6 (SIGABRT) (0x3eb00003d1d) received by PID 15645 (pthread TID 0x7fdab91d8700) (linux TID 15697) (maybe from PID 15645, UID 1003), stack trace: ***
@ 00007fdaedd6c649 folly::symbolizer::(anonymous namespace)::signalHandler(int, siginfo_t*, void*)
/usr/src/fb2/folly/folly/experimental/symbolizer/SignalHandler.cpp:414
@ 00007fdaeec3866f (unknown)
@ 00007fdaec98277f gsignal
@ 00007fdaec984379 abort
@ 00007fdaed2c6034 __gnu_cxx::__verbose_terminate_handler()
@ 00007fdaed2c3c25 (unknown)
@ 00007fdaed2c2b28 (unknown)
@ 00007fdaed2c3517 __gxx_personality_v0
@ 00007fdaecd23ed2 (unknown)
@ 00007fdaecd246fd _Unwind_Resume
@ 00007fdaed762c5b wangle::Acceptor::connectionReady(std::unique_ptr<folly::AsyncTransportWrapper, folly::DelayedDestruction::Destructor>, folly::SocketAddress const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, wangle::SecureTransportType, wangle::TransportInfo&)
@ 000055872ba40346 apache::thrift::PeekingManager::peekSuccess(std::vector<unsigned char, std::allocator >)
@ 000055872ba3f31c wangle::SocketPeeker::readDataAvailable(unsigned long)
@ 00007fdaedc7a07d folly::AsyncSocket::handleRead()
/usr/src/fb2/folly/folly/io/async/AsyncSocket.cpp:1663
@ 00007fdaedc72a1d folly::AsyncSocket::ioReady(unsigned short)
/usr/src/fb2/folly/folly/io/async/AsyncSocket.cpp:1493
@ 00007fdaea7d541f event_base_loop
@ 00007fdaedc9323f folly::EventBase::loopBody(int)
/usr/src/fb2/folly/folly/io/async/EventBase.cpp:315
@ 00007fdaedc93c65 folly::EventBase::loopForever()
/usr/src/fb2/folly/folly/io/async/EventBase.cpp:452
@ 00007fdaedc1d758 folly::IOThreadPoolExecutor::threadRun(std::shared_ptrfolly::ThreadPoolExecutor::Thread)
/usr/src/fb2/folly/folly/executors/IOThreadPoolExecutor.cpp:162
@ 00007fdaedc283ce void folly::detail::function::FunctionTraits<void ()>::callBig<std::_Bind<std::_Mem_fn<void (folly::ThreadPoolExecutor::)(std::shared_ptrfolly::ThreadPoolExecutor::Thread)> (folly::ThreadPoolExecutor, std::shared_ptrfolly::ThreadPoolExecutor::Thread)> >(folly::detail::function::Data&)
/usr/include/c++/6/functional:227
-> /usr/src/fb2/folly/folly/executors/ThreadPoolExecutor.cpp
@ 000055872b96a61a folly::detail::function::FunctionTraits<void ()>::operator()()
@ 000055872b9669c8 folly::NamedThreadFactory::newThread(folly::Function<void ()>&&)::{lambda()#1}::operator()()
@ 000055872b9abba9 void std::_Bind_simple<folly::NamedThreadFactory::newThread(folly::Function<void ()>&&)::{lambda()#1} ()>::_M_invoke<>(std::_Index_tuple<>)
@ 000055872b9aa319 std::_Bind_simple<folly::NamedThreadFactory::newThread(folly::Function<void ()>&&)::{lambda()#1} ()>::operator()()
@ 000055872b9a7d7d std::thread::_State_impl<std::_Bind_simple<folly::NamedThreadFactory::newThread(folly::Function<void ()>&&)::{lambda()#1} ()> >::_M_run()
@ 00007fdaed2efdee (unknown)
@ 00007fdaeec2e6d9 start_thread
@ 00007fdaeca55d7e clone
@ ffffffffffffffff (not found)
Aborted (core dumped)

@eduardo-elizondo
Copy link
Contributor

Do not use DuplexServer. It's deprecated and unmaintained! We have internal talks of deleting it pretty soon.

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

No branches or pull requests

2 participants