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

Fix #5134 segmentfault #5138

Merged
merged 4 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext-src/swoole_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ static void server_free_object(zend_object *object) {
delete property;

zend_object_std_dtor(object);
if (serv && ((serv->is_process_mode() && serv->is_master()) || serv->is_base_mode())) {
if (serv && serv->is_master()) {
delete serv;
}
}
Expand Down
1 change: 1 addition & 0 deletions include/swoole_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,7 @@ class Server {
}

int create_pipe_buffers();
void free_pipe_buffers();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

下面已经有个release_pipe_buffers()的定义,没有必要再定义free_pipe_buffers了吧

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

原来还有release_pipe_buffers这个定义,但是这个没有实现,待会把free_pipe_buffers直接改名成release_pipe_buffers好了

void release_pipe_buffers();
void create_worker(Worker *worker);
void destroy_worker(Worker *worker);
Expand Down
6 changes: 6 additions & 0 deletions src/server/master.cc
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,8 @@ void Server::destroy() {
join_reactor_thread();
}

free_pipe_buffers();

for (auto port : ports) {
port->close();
}
Expand Down Expand Up @@ -2013,6 +2015,10 @@ int Server::create_pipe_buffers() {
return message_bus.alloc_buffer() ? SW_OK : SW_ERR;
}

void Server::free_pipe_buffers() {
message_bus.free_buffer();
}

int Server::get_idle_worker_num() {
uint32_t i;
uint32_t idle_worker_num = 0;
Expand Down
Loading