Skip to content

Conversation

@ngxson
Copy link
Collaborator

@ngxson ngxson commented Feb 3, 2025

For httplib, the exceptions inside set_exception_handler and set_logger are not being handled

Comment on lines 3356 to 3363
try {
LOG_INF("request: %s %s %s %d\n", req.method.c_str(), req.path.c_str(), req.remote_addr.c_str(), res.status);

LOG_DBG("request: %s\n", req.body.c_str());
LOG_DBG("response: %s\n", res.body.c_str());
LOG_DBG("request: %s\n", req.body.c_str());
LOG_DBG("response: %s\n", res.body.c_str());
} catch (const std::exception & e) {
LOG_ERR("failed to log request/response: %s\n", e.what());
}
Copy link
Member

Choose a reason for hiding this comment

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

Do any of these throw?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, but this is mostly for future-proof.

Indeed, I was a bit doubt when adding this try..catch because I want to communicate to whoever in the future touching this code that "exception is not handled here". Another solution is to just add a TODO, but not sure if it's enough because people may not even read it.

Copy link
Member

Choose a reason for hiding this comment

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

IMO it's fine to remove the try/catch if it is not currently used.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK I replaced the try catch with a comment

@ngxson ngxson merged commit 3962fc1 into ggml-org:master Feb 4, 2025
46 checks passed
tinglou pushed a commit to tinglou/llama.cpp that referenced this pull request Feb 13, 2025
ggml-org#11620)

* server : add try..catch to places not covered by set_exception_handler

* log_server_request: rm try catch, add reminder
orca-zhang pushed a commit to orca-zhang/llama.cpp that referenced this pull request Feb 26, 2025
ggml-org#11620)

* server : add try..catch to places not covered by set_exception_handler

* log_server_request: rm try catch, add reminder
arthw pushed a commit to arthw/llama.cpp that referenced this pull request Feb 26, 2025
ggml-org#11620)

* server : add try..catch to places not covered by set_exception_handler

* log_server_request: rm try catch, add reminder
mglambda pushed a commit to mglambda/llama.cpp that referenced this pull request Mar 8, 2025
ggml-org#11620)

* server : add try..catch to places not covered by set_exception_handler

* log_server_request: rm try catch, add reminder
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.

3 participants