test server restart
- Dominant language
- C++
- Stars
- 3.1k
- Forks
- 547
- PR merge metrics
- No merged PRs in 30d
Description
trying to test the server restart case with independent IOThreadPool Echo example. patch EchoClient to catch folly::AsyncSocketException in the while loop (receive input and write to pipeline), so the while loop keeps forever.
test steps like:
1. start EchoServer
2. start EchoClient, write “a”
3. stop EchoServer
4. write “a” again at Client, this write will fail.
5. start EchoServer again.
6. But EchoClient could not auto-recover the broken socket.
Firstly need the similar patch with issue 45, to keep the EventBase in ClientBootstrap and implement ~ClientBootstrap.
Tried to call client.connect() again in the exception handling. But assert, `eventBase_->isInEventBaseThread()’, may fail when destruct the previous pipeline inside ClientBootstrap, as IOThreadPool is set to 2 and ClientBootstrap.connect() may select a new thread for it.
Had to allocate a new ClientBootstrap or added the reconnect() function to ClientBootstrap, which used the saved EventBase in ClientBootstrap.connect() to setup connection again. Is it the correct way to handle the server process restart?
Contributor guide
Assessment
This issue has not been assessed yet.