sshnet / sshnet/SSH.NET

StackoverflowException when connecting using private key

Open
#156 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
4.4k
Forks
993
Avg merge
9d 21h
Merged PRs (30d)
1

Description

SSH.NET version 2016.0.0 (release as well as debug mode)
Remote SSH Server version: Serv-U MFTP FTP 15.1.4.6 (using username/password and private key)
Remote Operating System distribution name and architecture (x32/x64): x64
What kind of access do you have?: Local machine
Does Putty/WinSCP work?: Yep, SSH.NET also works most (ie 99,9%) of the time
Operating System (for Windows, run winver.exe): Windows 2012 R2 build 9600
.NET Framework versions installed (See C:\WINDOWS\Microsoft.Net\Framework): .NET 4.6
What is your target framework and architecture (x32/x64)?: x64
Is your project multi-threaded/complex?: No, I can replicate using single thread

We have created a console application, that periodically monitors a local SFTP server for new files. Sometimes, the process hangs and a StackOverflow exception is logged, crashing the process.

We are using a Dispose-pattern, where each new poll gets a new instance of Sftp, connects and calls Sftp.ListDirectory("/dirname"); after polling files, the connection is disconnected and disposed, using a using-statement in our program.

As this is a StackOverflow exception, I cannot pinpoint the exact point, where the program crashes, however I have attached trace from System.Diagnostics, that hopefully can provide some insight.
SSHtrace.txt

BTW: Thank you for a fantastic SSH/SFTP-library, I'm very impressed with the feature set as well as the performance!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the attached SSHtrace.txt and the polling entry point around Sftp.ListDirectory("/dirname"), then inspect the repeated connect, disconnect, and Dispose flow described in the report. Done means the cause of the intermittent StackOverflowException is identified and the repeated polling scenario no longer crashes.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.