Skip to content

server : fix coredump on std::terminate() #12831 #13088

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

Closed
wants to merge 1 commit into from

Conversation

tyronecai
Copy link

@tyronecai tyronecai commented Apr 24, 2025

Refer to

#12831

std::terminate make coredump again

So perhaps returning "server_task_result_error" to indicate that the server has stopped,
is the most straightforward way to terminate the process with minimal changes.

original code
image

new code
image

@ngxson Please take a look at this review


if (!running) {
SRV_DBG("%s : queue result stop\n", __func__);
auto res = std::make_unique<server_task_result_error>();
Copy link
Collaborator

@ngxson ngxson Apr 24, 2025

Choose a reason for hiding this comment

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

It's not a good idea to return server_task_result_error

Some handlers create task with type cancel upon receiving server_task_result_error, so the server will probably hangs. You should check all code paths, not just one single use case.

It's better to throw an exception here

@tyronecai tyronecai closed this Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants