Bug 56282 - BlockingCollection<T>.Take throws ThreadAbortException
Summary: BlockingCollection<T>.Take throws ThreadAbortException
Status: NEW
Alias: None
Product: Runtime
Classification: Mono
Component: io-layer (show other bugs)
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-05-12 11:45 UTC by Narinder
Modified: 2017-05-12 14:11 UTC (History)
3 users (show)

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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 for Bug 56282 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description Narinder 2017-05-12 11:45:17 UTC
Hi,

On Debian 8.5 and :
Mono JIT compiler version 5.0.0 (explicit/9667aa6 Fri 12 May 10:13:13 BST 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           __thread
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	LLVM:          supported, not enabled.
	GC:            sgen (concurrent by default)


The following code :

            BlockingCollection<byte[]>  theQ = new BlockingCollection<byte[]>();
            public byte[] Take(CancellationToken cts)
            {
                try
                {
                    return theQ.Take(cts);
                }
                catch (ThreadAbortException e)
                {
                    Console.WriteLine(e);
                    throw;
                }
            }


raise an exception of type ThreadAbortException. It's not deterministic. 

From my understanding thr only two exceptions that should be throwable by Take are :

ObjectDisposedException
and 
InvalidOperationException


Regards
N
Comment 1 Narinder 2017-05-12 11:46:54 UTC
.. samew in 

Mono JIT compiler version 5.3.0 (master/52d82cb Fri 12 May 11:19:29 BST 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           __thread
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	LLVM:          supported, not enabled.
	GC:            sgen (concurrent by default)






System.Threading.ThreadAbortException
  at (wrapper managed-to-native) System.Threading.Monitor:Monitor_wait (object,int)
  at System.Threading.Monitor.ObjWait (System.Boolean exitContext, System.Int32 millisecondsTimeout, System.Object obj) [0x0002f] in <b4559376e4e44c778a5aca479c666247>:0 
  at System.Threading.Monitor.Wait (System.Object obj, System.Int32 millisecondsTimeout, System.Boolean exitContext) [0x0000e] in <b4559376e4e44c778a5aca479c666247>:0 
  at System.Threading.Monitor.Wait (System.Object obj, System.Int32 millisecondsTimeout) [0x00000] in <b4559376e4e44c778a5aca479c666247>:0 
  at System.Threading.SemaphoreSlim.WaitUntilCountOrTimeout (System.Int32 millisecondsTimeout, System.UInt32 startTime, System.Threading.CancellationToken cancellationToken) [0x0001d] in <b4559376e4e44c778a5aca479c666247>:0 
  at System.Threading.SemaphoreSlim.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x000ca] in <b4559376e4e44c778a5aca479c666247>:0 
  at System.Collections.Concurrent.BlockingCollection`1[T].TryTakeWithNoTimeValidation (T& item, System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken, System.Threading.CancellationTokenSource combinedTokenSource) [0x00067] in <4f36bbc2d5a044eb8efd99751c88065f>:0 
  at System.Collections.Concurrent.BlockingCollection`1[T].TryTake (T& item, System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00006] in <4f36bbc2d5a044eb8efd99751c88065f>:0 
  at System.Collections.Concurrent.BlockingCollection`1[T].Take (System.Threading.CancellationToken cancellationToken) [0x00000] in <4f36bbc2d5a044eb8efd99751c88065f>:0