arvidn / libtorrent

an efficient feature complete C++ bittorrent implementation
http://libtorrent.org
Other
5.12k stars 989 forks source link

Unhandled exception thrown by Boost.Asio #7371

Open glassez opened 1 year ago

glassez commented 1 year ago

There are many crash reports in qBittorrent bug tracker that point to unhandled exception thrown in boost::asio::detail::socket_select_interrupter::open_descriptors. IIRC, exception is often thrown once some VPN service is enabled during qBittorrent run.

glassez commented 1 year ago

Yet another related crash report, but qBittorrent is crashed after hibernation: https://github.com/qbittorrent/qBittorrent/issues/18823.

xavier2k6 commented 1 year ago

@arvidn Going over chriskohlhoff/asio#1061 (comment) & chriskohlhoff/asio#1061 (comment) - I don't know if this is related/relevant but the only place left in libtorrent code that wasn't changed from async_receive to async_receive_from was in ip_notifier.cpp

https://github.com/arvidn/libtorrent/blob/6d64ac1dadb17df1c5719eb66179ac47e95eba12/src/ip_notifier.cpp#L155 &

https://github.com/arvidn/libtorrent/blob/6d64ac1dadb17df1c5719eb66179ac47e95eba12/src/ip_notifier.cpp#L218

What if there's a socket failure/error not properly being handled??

xavier2k6 commented 1 year ago

@arvidn Reproducible steps in https://github.com/qbittorrent/qBittorrent/issues/18811#issuecomment-1501165433

xavier2k6 commented 1 year ago

@arvidn Ping

xavier2k6 commented 1 year ago

I see you're prepping 2.0.9 / 1.2.19 for release, would a fix for this issue make it in to these versions by any chance?

arvidn commented 1 year ago

I don't believe there is a fix

arvidn commented 1 year ago

I don't know if this is related/relevant but the only place left in libtorrent code that wasn't changed from async_receive to async_receive_from was in ip_notifier.cpp

Chris' comment was about using null_buffers instead of allocating the receive buffer up-front. In more recent versions of asio, null_buffers have been replaced by async_wait() on sockets. This is still done on the UDP socket.

stale[bot] commented 10 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

xavier2k6 commented 10 months ago

keep alive

xavier2k6 commented 9 months ago

First record/reference of issue with boost::asio::detail::socket_select_interrupter::open_descriptors

xavier2k6 commented 8 months ago

We are still getting crash reports of this over at qBittorrent.

arvidn commented 8 months ago

I suspect I would need to not use async_wait() on sockets.