Skip to content

Fix uncaught exception #1393

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

Merged
merged 1 commit into from
Apr 23, 2020
Merged

Fix uncaught exception #1393

merged 1 commit into from
Apr 23, 2020

Conversation

garethsb
Copy link
Contributor

PR #1310 added TCP_NODELAY as a performance optimization to ASIO-based http_client and http_listener. Unfortunately, the innocent-looking set_option can throw boost::system::system_error, which was not handled and therefore results in std::terminate.

I've never seen this happen on various Windows and Linux environments, but on a macOS VM we have now seen the http_client-side issue if the server closes the socket with just the right timing. It's hard to test, often takes 10 minutes in that environment.

My approach here is to ignore errors (we've seen EBADF and EINVAL), since this is a performance optimization only, and hard errors will be picked up by the write operation on the socket which follows immediately.

… since this is a performance optimization only, and hard errors will be picked up by the following operation
@reneme
Copy link
Contributor

reneme commented Apr 22, 2020

Wow!

Just a few days ago, we got reports from our QA team about crashes in our latest release candidate (based on cpprestsdk 2.10.15). They are testing in a macOS VMs (!). Neither on the macOS development machines nor on Windows VMs of the QA team did we manage to reproduce those crashes.

We just started looking into that issue this morning and didn't have a clue what was going on so far. There's a good chance that you just saved our release!

Thank you very much!

@garethsb
Copy link
Contributor Author

@reneme, I'm sorry that I broke it in the first place! Interesting to hear that you had exactly the same platform results as us.

@BillyONeal BillyONeal merged commit 538dd49 into microsoft:master Apr 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants