Skip to content

Commit

Permalink
fix: fix pika coredump when process exit (OpenAtomFoundation#1820)
Browse files Browse the repository at this point in the history
PikaReplServer cleanup connections when destroy function called, cleanup will trigger FdClosedHandle which calls already destroyed pikaserver.
So manually call cleanup ahead before pikaserver destroyed.

Co-authored-by: wangshaoyi <[email protected]>
  • Loading branch information
wangshao1 and wangshaoyi authored Jul 26, 2023
1 parent 1c54ea5 commit 48c9703
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/net/src/holy_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class HolyThread : public ServerThread {
virtual std::shared_ptr<NetConn> get_conn(int fd);

void ProcessNotifyEvents(const net::NetFiredEvent* pfe) override;
void Cleanup();

private:
mutable pstd::RWMutex rwlock_; /* For external statistics */
Expand All @@ -72,7 +73,6 @@ class HolyThread : public ServerThread {
void HandleConnEvent(NetFiredEvent* pfe) override;

void CloseFd(const std::shared_ptr<NetConn>& conn);
void Cleanup();
}; // class HolyThread

} // namespace net
Expand Down
1 change: 1 addition & 0 deletions src/pika_repl_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ int PikaReplServer::Start() {
int PikaReplServer::Stop() {
server_tp_->stop_thread_pool();
pika_repl_server_thread_->StopThread();
pika_repl_server_thread_->Cleanup();
return 0;
}

Expand Down

0 comments on commit 48c9703

Please sign in to comment.