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)

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


Attachments

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

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