Skip to content

Conversation

IgorMilavec
Copy link
Collaborator

@IgorMilavec IgorMilavec commented Nov 21, 2021

Changed the Session.Connect to use ThreadAbstraction.ExecuteThreadLongRunning to start the MessageListener.

The commit 5d173c8 also includes cleanup of ThreadAbstraction, which I did because I wasn't sure anymore which target was used as a dependency. I feel this cleanup is beneficial in the long run, but if you feel this is too much for this PR let me know and I'll roll it back.

Fixes #824

/// <param name="action">The action to execute.</param>
public static void ExecuteThread(Action action)
{
#if FEATURE_THREAD_THREADPOOL
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid you'll need to revert these changes. ThreadPool is not available for UAP10.0 TFM (see https://github.com/sshnet/SSH.NET/wiki/Conditional-compilation-symbols for more information).


public static void ExecuteThreadLongRunning(Action action)
{
#if FEATURE_THREAD_TAP
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose to leave this as is. Eventually, we'll need to change this as we need the thread or task that we started for our message listener in order to avoid thread leaks (there's an issue for this).

/// <param name="millisecondsTimeout">The number of milliseconds for which the thread is suspended.</param>
public static void Sleep(int millisecondsTimeout)
{
#if FEATURE_THREAD_SLEEP
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid you'll need to revert these changes. Thread.Sleep(...) is not available for UAP10.0 TFM (see https://github.com/sshnet/SSH.NET/wiki/Conditional-compilation-symbols for more information).

@IgorMilavec
Copy link
Collaborator Author

Sorry, I've made an error to "Fetch upstream" from GitHub and it messed up the commit history.
So it was more clean to just do a new PR #902. I'm closing this one.

@IgorMilavec IgorMilavec deleted the Issue824 branch December 17, 2021 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Thread pool exhaustion due to MessageListener running on ThreadPool

2 participants