SSHClient: ForwardedPortLocal: memory issue
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 30/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- csharp
- Lĩnh vực
- networking
Hướng nghiên cứu
Bắt đầu với điểm vào ConnectSSH và việc tạo ForwardedPortLocal lặp lại được nêu trong báo cáo. Tái hiện kịch bản chạy qua đêm hoặc gọi lặp lại, sau đó theo dõi vòng đời chuyển tiếp cổng và hành vi giải phóng; được xem là hoàn tất khi các kết nối lặp lại không còn cho thấy mức sử dụng bộ nhớ tăng đều đặn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hello,
I am using the following code below. I call this ConnectSSH() every 5 seconds (as a test to see how it performs)
After I let this run a night, i see that the used memory increased significantly, and it keeps rising.
After some investigation on my own, i notice that when I remove the "forwardedportlocal" object, (so I don't make such an object, and I obviously don't start it) Then there is no memory issue. The client is created, and then disposed cleanly.
I can see this happening the diagnostic tool of visual studio.
I already added portfwld.stop() and portfwld.dispose() together with of course SshClient.disconnect() and SshClient.dispose()
but that did not help.
I made a version in vb.net and also one in c#, but the results are the same.
I also Commented the connection to the database to show that this is not the issue.
I hope someone can give me some insight of what is happening, or perhaps what I am doing wrong?
class mySQLviaSHH
{
public void ConnectSSH()
{
using (var SSHClient = new SshClient("myhost", "administrator", "mypassword"))
{
try
{
// Console.WriteLine("Trying SSH connection...")
SSHClient.Connect();
if (SSHClient.IsConnected)
Console.WriteLine("SSH connection is active");
else
Console.WriteLine("SSH connection has failed");
Console.WriteLine("Trying port forwarding...");
var portFwld = new ForwardedPortLocal("127.0.0.1", "127.0.0.1", 3306);
SSHClient.AddForwardedPort(portFwld);
portFwld.Start();
if (portFwld.IsStarted)
Console.WriteLine("Port forwarded: {0}", portFwld.ToString());
else
Console.WriteLine("Port forwarding has failed.");
}
catch (SshException e)
{
Console.WriteLine("SSH client connection error: {0}", e.Message);
}
}
}
}
Public Sub ConnectSSH()
Using SSHClient = New SshClient("myhost", "administrator", "mypassword")
Try
Console.WriteLine("Trying SSH connection...")
SSHClient.Connect()
If SSHClient.IsConnected Then
Console.WriteLine("SSH connection is active")
Else
Console.WriteLine("SSH connection has failed")
End If
Console.WriteLine(vbCrLf & "Trying port forwarding...")
Dim portFwld = New ForwardedPortLocal("127.0.0.1", "127.0.0.1", 3306)
SSHClient.AddForwardedPort(portFwld)
portFwld.Start()
If portFwld.IsStarted Then
Console.WriteLine("Port forwarded: {0}", portFwld.ToString())
' 'Dim dbConnect As DBConnect = New DBConnect(portFwld.BoundHost, "wcs_sch", "root", "dbpassword", "3306")
' 'Dim ct = dbConnect.Count("wcs_msg_host")
' 'Console.WriteLine(ct.ToString())
Else
Console.WriteLine("Port forwarding has failed.")
End If
Catch e As SshException
Console.WriteLine("SSH client connection error: {0}", e.Message)
Catch e As System.Net.Sockets.SocketException
Console.WriteLine("Socket connection error: {0}", e.Message)
End Try
End Using
End Sub
- Ngôn ngữ chính
- C#
- Star
- 4.4k
- Fork
- 993
- Merge trung bình
- 9 ngày 21 giờ
- Pull request đã merge (30 ngày)
- 1
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của sshnet/SSH.NET
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
-
Using SshClient on Linux under Wine throws System.Security.Cryptography.CryptographicException Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 67/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
Tất cả issue của sshnet/SSH.NET
Issue tương tự
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
sillsdev/languageforge-lexbox#2665 ·
-
bug documentation frontend
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
azurenoops/spin_agent#975 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
SubtitleEdit/subtitleedit#15108 · 1 bình luận ·