[jcifs] preventing soTimeout NT_STATUS_ACCESS_VIOLATION w/ NTLM
Michael B Allen
mba2000 at ioplex.com
Wed Jun 15 17:28:12 GMT 2005
On Wed, 15 Jun 2005 10:43:26 -0500
"Tapperson Kevin" <Kevin.Tapperson at hcahealthcare.com> wrote:
> I have had success in preventing jcifs from throwing an SmbAuthException with the NT_STATUS_ACCESS_VIOLATION ("Invalid access to memory location") error code in association with an soTimeout event by implementing a reference counter for NTLM HTTP authentication requests in the SmbTransport class. The following changes described below were done on the jcifs_1.1.10 code base. I checked the jcifs_1.2.0 code base to see how different the changes would be for it. The only major difference is the change in the SmbTransport.run() method. (In 1.2.0, the changes below to SmbTransport would need to go into the Transport class and the Transport.disconnect() method.)
Why is this necessary? My understanding is that with the default soTimeout
value of 10 minutes the chances of getting an access violation situation
are very slight. What soTimeout value are you using?
> I also noticed in jcifs_1.2.0 that the Transport.loop() method (portions equivalent to the old SmbTransport.run() method) no longer distinguishes between an InterruptedIOException and an IOException; it instead uses the exception message to determine if the error is a "hard" error or an soTimeout event. I would strongly caution against doing this. In my experience, exception messages are often different on various platforms and may differ by JVM vendor as well (Sun vs. IBM). In particular, I have seen that socket-related exception messages appear to differ quite significantly.
Well the problem is that the exceptions I'm interested in are ones that
make the socket unwriteable. Meaning if you cannot write a "logoff"
message to the socket we disconnect( hard ) indicating that no such
messages should try be sent. I'll have to look at the code and see what
I can do about it.
More information about the jcifs