Comments (15)
Difference between Disconnect and Socket was asked and answered on Stack Overflow
https://stackoverflow.com/questions/31031835/socket-disconnect-vs-socket-close
Does the answer make sense to you?
from smblibrary.
dms-app | Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
dms-app | at SMBLibrary.NetBios.NBTConnectionReceiveBuffer.get_AvailableLength()
dms-app | at SMBLibrary.Client.SMB2Client.OnClientSocketReceive(IAsyncResult ar)
dms-app | at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
dms-app | --- End of stack trace from previous location ---
dms-app | at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
dms-app | at System.Threading.Tasks.AwaitTaskContinuation.RunCallback(ContextCallback callback, Object state, Task& currentTask)
dms-app | --- End of stack trace from previous location ---
dms-app | at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
dms-app | at System.Threading.ThreadPoolWorkQueue.Dispatch()
dms-app | at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
dms-app | Aborted (core dumped)
dms-app exited with code 0
this actually crashes the whole api
from smblibrary.
SMB2Client
private void OnClientSocketReceive(IAsyncResult ar)
line 433 calls getter on property AvailableLength:
clientSocket.BeginReceive(receiveBuffer.Buffer, receiveBuffer.WriteOffset, receiveBuffer.AvailableLength, SocketFlags.None, OnClientSocketReceive, connectionState);
NBTConnectionReceiveBuffer
line 31
public int AvailableLength => m_buffer.Length - (m_readOffset + m_bytesInBuffer);
m_buffer must be null at this point (which means the receive buffer is already disposed at this point)
I believe it is therefore important to shutdown, and close the socket before disposing the buffer.
SMBClient2 lines 212 and 213
m_clientSocket.Disconnect(reuseSocket: false);
m_connectionState.ReceiveBuffer.Dispose();
from smblibrary.
Thanks,
I was not able to reproduce this, but calling Close on the socket is consistent with the server implementation, I have update the client code to invoke Close before disposing of the buffer - this change is included in v1.5.1.2, please update if there is any further issue.
from smblibrary.
Hi,
wanted to upgrade to 1.5.1.2 and test it, but don't find the version yet. Are you sure 1.5.1.2 is released?
from smblibrary.
Sorry, forgot to hit the button, 1.5.1.2 is out now.
from smblibrary.
@TalAloni I'm using 1.5.1.3 and this is still happening randomly... sometimes when I'm just recursing a directory path, or creating a file or directory. Is there a recommended way to handle the lifecycle of client requests? I've been using try/catch/finally, and disconnecting the client and then the filestore in the "finally" block.
from smblibrary.
@argentini adding information about a 1.5.1.1 issue that was already resolved and presenting it as an 1.5.1.3 issue is a sure way for miscommunication and I suspect it will not lead to any resolution.
Please create a new issue and explain exactly what are you doing and what are the symptoms and how to recreate. Thanks!
from smblibrary.
@TalAloni Understood. I assumed this was the same issue so I thought it made sense to add a comment here. Since the exception cannot be caught I cannot inspect it, and I'm not sure how to reproduce it. The large file read/write client examples appear to be incorrect. They use a streams but do not close the streams or declare them in a using block. So all this is why I was asking about the lifecycle. I want to make sure I'm using the library correctly to see if the issue reappears so I can try to find replication steps. Otherwise you won't stand a chance at fixing it.
from smblibrary.
Related Issues (20)
- ACCESS_DENIED_ACE type is missing HOT 1
- Login without user and password HOT 1
- Bug after latest ArrayPool implementation HOT 4
- Issue not receiving ReadResponse when reading a file HOT 16
- Renaming File to one Character HOT 1
- Async exception on sync operation HOT 6
- SMBServer.exe HOT 1
- how can I use SMB2 upload larger file in 'ResumeFromBreakPoint' mode? HOT 4
- Copying a file while having an STATUS_SHARING_VIOLATION HOT 1
- UnobservedTaskException after Client.Disconnect() HOT 5
- SMBServer.exe HOT 1
- IsLoggedIn Getter HOT 1
- Exception thrown by .net Framework. HOT 7
- How to Access a File With in the Sub Folders Using SMB2Client
- [Question] FileSystemWatcher-like support HOT 1
- tree connect returning null HOT 1
- SMB3 client on samba server HOT 4
- Unable to access file in subdirectory HOT 1
- SMB1Client Connect method not timing out HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from smblibrary.