Bug 37475 - WebRequest has several race conditions/crashes/deadlocks
Summary: WebRequest has several race conditions/crashes/deadlocks
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-01-07 10:33 UTC by Alan McGovern
Modified: 2016-04-16 08:00 UTC (History)
4 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Alan McGovern 2016-01-07 10:33:25 UTC
This testcase uncovers several issues:

https://gist.github.com/alanmcgovern/88fd898a4ae7dd669684

1) 'EndGetResponse' should throw a 'WebException' if Abort has been invoked. This happens sometimes, other times we get an ObjectDisposedException.

2) Sometimes 'EndGetResponse' deadlocks.

3) Sometimes calling client.BeginGetResponse throws a SynchronizationLockException (or something) when it invokes Monitor.Exit internally. I didn't record the stacktrace, but i'll attach it when i trigger it again.

4) If you add a 'System.Threading.Thread.Sleep (1);' call right after the BeginInvoke the test starts failing because of a ConnectException on only the third iteration http://screencast.com/t/VjiD86bx . If you remove the 'Abort' then everything works as expected for all 100 iterations. Stacktrace of the exception: https://gist.github.com/alanmcgovern/9109e29d7660b7acc5f2

5) Sometimes the entire app crashes because we don't handle the abort correctly internally. I triggered that by inserting a 2ms delay between the 'BeginGetResponse' and 'Abort' calls:
https://gist.github.com/alanmcgovern/ecbaa516fd0c8543b160

6) Finally another case of the wrong exception being thrown from EndGetResponse: https://gist.github.com/alanmcgovern/26c7ca23fed6a4217365

Note You need to log in before you can comment on or make changes to this bug.