Quantcast
Channel: sshnet Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 1026

Created Issue: Consider killing off the TaskFactory [1552]

$
0
0
We are moving to NServiceBus for some of our parts of the software, and suddenly the library stopped working (connection timeouts). So after a few hours of double checking everything, I decided to download the source and try it myself.

I found that the Connect method spawns a new listener thread (ExecuteThread). In this thread (NET40), the TaskFactory is used. However, when ran in my NServiceBus node the thread nevers gets spawned though the max number of threads is not just 1.

I have changed the ExecuteThread from:

Task.Factory.StartNew(action, TaskCreationOptions.LongRunning);

To

ThreadPool.QueueUserWorkItem((o) => { action(); });

And now it works great again.

Now to prevent any discussion whether this is or not is a bug in NServiceBus, it seems that the TaskFactory is not able to spawn the thread where the ThreadPool is able to. I actually don't see any reason to use the TaskFactory here.

Viewing all articles
Browse latest Browse all 1026

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>