[jcifs] jcifs-1.2.4 stability fixes

Lars heete hel at admin.de
Thu Sep 29 15:10:30 GMT 2005


Hello,

a customer of me had severe problems using jcifs (1.1 and 1.2) in a large 
intranet application. There were lots of deadlocks/livelocks especially in 
this environment, where transport disconnects seem to be quite frequent.
I worked several days to fix these problems. The attached patches against
jcifs-1.2.4 

The first three patches are simple fixes

 jcifs-buffer-check.diff - check buffer bounds to avoid exception in transport
 jcifs-handle_close.diff - handle close on negotiate
 jcifs-buffer.diff  - use one buffer per transport instance (performance)


the next three are session/tree fixes, and depend on each other due patch 
context. 

 jcifs-session-expiration.diff - modify session expiration to avoid session 		
					  logoff in busy sessions. 
 jcifs-session-assoc.diff - fix session->transport association to avoid
				     connects on NULL_TRANSPORT and active
				     sessions that aren't registered in transport.sessions.

 jcifs-tcon_hostname.diff - reuse available host-name to avoid reconnects

The last two are transport fixes:

 jcifs-transport_setup.diff - 
     modify transport setup to allow timeouts on socket.connect,
     if netbios.hostname is specified force to netbios port 139
     fix session-transport matching if transport.port != DEFAULT_PORT

 jcifs-threading.diff - 
     the biggest one ... there is a big locking problem between 
     treeConnect/sessionSetup/sessionExpiration  and transport closedown via
     disconnect. Both take the transport-monitor, and if the transport
     socket-connection closes with sessions at a high frequency, 
     wrong thread may wait on transport.response_map with transport monitor
     hold, so transport.disconnect will not run, and the transport is unusable
     for a long time (at least REQUEST_TIMEOUT)
     The changes try adress this problem by signalling not only responses but 
     also transport state changes via transport.response_map, and setting 
     transport.state CLOSING to indicate transport closedown before
     disconnect, so any waiting thread can leave the transport monitor.

the changes are well tested (changing the applications surviving time from 15 
min to at least 2 Weeks)

Regards,
Lars Heete
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jcifs_buffer.diff
Type: text/x-diff
Size: 873 bytes
Desc: not available
Url : http://lists.samba.org/archive/jcifs/attachments/20050929/3735778f/jcifs_buffer-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jcifs-buffer-check.diff
Type: text/x-diff
Size: 525 bytes
Desc: not available
Url : http://lists.samba.org/archive/jcifs/attachments/20050929/3735778f/jcifs-buffer-check-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jcifs-tcon_hostname.diff
Type: text/x-diff
Size: 2230 bytes
Desc: not available
Url : http://lists.samba.org/archive/jcifs/attachments/20050929/3735778f/jcifs-tcon_hostname-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jcifs-session-expiration.diff
Type: text/x-diff
Size: 931 bytes
Desc: not available
Url : http://lists.samba.org/archive/jcifs/attachments/20050929/3735778f/jcifs-session-expiration-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jcifs-threading.diff
Type: text/x-diff
Size: 13494 bytes
Desc: not available
Url : http://lists.samba.org/archive/jcifs/attachments/20050929/3735778f/jcifs-threading-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jcifs-transport_setup.diff
Type: text/x-diff
Size: 4970 bytes
Desc: not available
Url : http://lists.samba.org/archive/jcifs/attachments/20050929/3735778f/jcifs-transport_setup-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jcifs-handle_close.diff
Type: text/x-diff
Size: 794 bytes
Desc: not available
Url : http://lists.samba.org/archive/jcifs/attachments/20050929/3735778f/jcifs-handle_close-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jcifs-session-assoc.diff
Type: text/x-diff
Size: 3754 bytes
Desc: not available
Url : http://lists.samba.org/archive/jcifs/attachments/20050929/3735778f/jcifs-session-assoc-0001.bin


More information about the jcifs mailing list