Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Sorry, this won't be a useful bug report, but here goes:
I received the following exception from a MonoTouch 5.2.11 app running on an iPhone with iOS 5.1.1: ThreadStateException "Unable to reset abort because no abort was requested"
The crash log did not include a full stack trace, but shows that the phone was in poor network conditions and had been repeatedly aborting HttpWebRequests after a timeout period.
Since there are no ResetAborts in our app I think the only realistic source is https://github.com/mono/mono/blob/mono-2-10/mcs/class/System/System.Net.Sockets/Socket_2_1.cs#L1239
which is triggered if you abort a webrequest while it is waiting for the socket to connect.
This doesn't make much sense, since a ThreadAbortException just happened, and thread state really should be aborted.
At this point I'm out of ideas. Am not sure how to repro, or how I might work around the problem.
The closest I have to a theory is that WebConnection.Abort doesn't appear to be thread-safe. WebConnection.Close locks "this" before closing the socket (https://github.com/mono/mono/blob/mono-2-10/mcs/class/System/System.Net/WebConnection.cs#L1058), but WebConnection.Connect locks "socketLock" while also closing the socket (https://github.com/mono/mono/blob/mono-2-10/mcs/class/System/System.Net/WebConnection.cs#L134). In theory socket.Dispose() could be called twice, but am not sure how that would result in a ThreadStateException
Gonzalo, this looks like your area.
Not much here that I can use. But here goes another theory: it could be a problem in the runtime thread-related code when setting and resetting the thread status.
We have implemented a milder way of closing pending connections that does not involve Thread.Abort.
Fix is now on master/mono-10 and mobile-master, and making its way through QA for both MonoTouch and Mono for Android.