Open pasiorovuo opened 4 years ago
@pasiorovuo : May I know if there is prolonged time lapse where the SMBConnection instance was left idling in your application? You have mentioned that pysmb fails after around 15 minutes,
SMBConnection was not designed to be left idle by the application. When SMBConnection is left idle, it is unable to keep the SMB connection "alive", so the server might just assume the connection is dead and close the connection.
We thought about that too. However, in our case we move (read, copy, delete from SMB location) small files, ranging from few kb to 100 kb from an on-premise location to AWS S3. The process was moving around 10 to 15 files per second without idle periods.
The issue can be worked around with using is_direct_tcp=False
during creation of the connection.
We have been experiencing an odd issue where pysmb fails after around 15 minutes, with the exception below (date + time added by execution script):
We initiated the connection with following command:
is_direct_tcp
being the thing to note here.I took a look at the source code of version
1.2.1
and traced back to where the exception originated, and this stands out in method decode on line 57 ofnmb_structs.py
:length = struct.unpack(self.HEADER_STRUCT_FORMAT, data[offset:offset+self.HEADER_STRUCT_SIZE])[0]
On line 33 in same file (decode() of NMBSessionMessage) we have:
self.type, self.flags, length = struct.unpack(self.HEADER_STRUCT_FORMAT, data[offset:offset+self.HEADER_STRUCT_SIZE])
Difference being that the length is the 3rd element of the tuple returned by decode() of NMBSessionMessage and 1st in DirectTCPSessionMessage's decode(). Could this be the issue here?