OpenListTeam / OpenListTeam/OpenList
[BUG] SMB sessions leak during long transfers until Windows connection limit is reached
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 24.7k
- Forks
- 2.3k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 36
Description
Please confirm the following
- I have read and agree to AGPL-3.0 Section 15 and Section 16.
- I confirm this issue is about OpenList behavior.
- I confirm this is not fixed in the latest
mainbranch. - I searched existing issues and found a related closed report: #2228.
OpenList Version
Current main branch.
Storage Driver Used
SMB
Bug Description
When using an SMB storage as the source and copying many files from OpenList to another cloud storage, Windows 11 Pro keeps accumulating SMB sessions from the OpenList host. Once Windows reaches its 20-session limit, all subsequent files that have not started copying fail with:
Failed load storage: failed init storage: No more connections can be made to this remote computer at this time because the computer has already accepted the maximum number of connections.
On the Windows 11 Pro SMB server, net session shows 20 active sessions. After copy traffic stops, waiting several hours does not release those sessions automatically.
This is related to #2228, but that report was closed as invalid because of the issue template checkbox. This issue adds a more specific reproduction path and root-cause analysis.
Root Cause
The SMB driver currently keeps only *smb2.Share and calls Share.Umount() when dropping or refreshing the connection. However, cloudsoda/go-smb2 models SMB cleanup in layers:
- open files need
File.Close(); - mounted shares need
Share.Umount(); - authenticated sessions need
Session.Logoff().
Because OpenList does not keep the *smb2.Session, it cannot call Session.Logoff(). During long or repeated transfer workloads, old SMB sessions can remain open on the Windows server even after the share is unmounted locally.
Long-running transfers also make this easier to trigger: Link() opens an SMB file stream, but later operations may decide the shared SMB connection is stale because lastConnTime was only updated when the link was created, not while the file is still being read.
Expected Behavior
OpenList should close SMB files, unmount the share, and log off the SMB session. Long-running downloads/uploads/copies should keep the current SMB session alive until the transfer stream closes, so background refresh logic does not replace the session while it is still in use.
Reproduction
- Configure Windows 11 Pro as an SMB server.
- Mount that SMB share in OpenList.
- Copy many files from the SMB storage to another cloud storage through OpenList.
- Watch
net sessionon Windows. - The session count grows to 20.
- Remaining files fail with the Windows connection limit error.
- Stop traffic and wait several hours.
- The 20 sessions remain until they are manually deleted, for example with
net session \\<client-ip> /delete, or the server is restarted.
Logs
No more connections can be made to this remote computer at this time because the computer has already accepted the maximum number of connections.
Proposed Fix
Keep the SMB session in the driver, call Session.Logoff() during cleanup, and protect active transfers from idle reconnect logic until their streams are closed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the SMB driver's Link() path and its connection cleanup and refresh logic; inspect how *smb2.Share, files, and sessions from cloudsoda/go-smb2 are retained. Done means cleanup logs off SMB sessions and long-running streams prevent stale-connection replacement until they close, verified with the described repeated-copy reproduction and Windows net session observations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100