smb_receive problem with 2.2.3

Esh, Andrew AEsh at
Fri Feb 15 08:58:35 GMT 2002

While doing a number of tests, one of my associates found the cause
of the failure of one our Samba file access torture tests. I am wondering
why the code to return READ_ERROR was added to smb_receive.

Here is his analysis:
It appears that the behavior of receive_smb was changed in 2.2.3
so that if the receipt of a message times out, it sets the global
variable smb_read_error to READ_ERROR.  The line of code [pointed out]
below is new with 2.2.3 and is causing our problem.  Simply by
commenting out that line, [our test] appears to run.

	BOOL receive_smb(int fd,char *buffer, unsigned int timeout)  
		ssize_t len,ret;

		smb_read_error = 0;

		memset(buffer,'\0',smb_size + 100);

		len = read_smb_length_return_keepalive(fd,buffer,timeout);
		if (len < 0) {
			DEBUG(10,("receive_smb: length < 0!\n"));
---->			smb_read_error = READ_ERROR;

Details: In the current code when oplock_break calls receive_smb
an error and sees that smb_read_error is READ_ERROR, it restarts
samba.  Any pending requests are thrown on the floor and the client
240 [windows reports "f0"] errors.

In the old code, if a request timed out, then smb_read_error would be
set to READ_TIMEOUT by the call to read_socket_with_timeout
made by read_smb_length_return_keepalive.  Then oplock_break
would handle that case more gracefully.

Now it may be that this is simply a bug and we just need to get rid 
of that line of code to get our tests to run again.  However, if we are
hitting this timeout condition, it seems to imply that for a particular
Samba is waiting for an oplock message for 30 seconds before it finally
up and continues.  We need to investigate further whether the client
isn't responding and if so, why as this would have a really big impact
on performance and could lead to other client errors.

Andrew C. Esh                mail:Andrew.Esh at
Tricord Systems, Inc.
2905 Northwest Blvd., Suite 20        763-557-9005 (main)
Plymouth, MN 55441-2644 USA      763-551-6418 (direct) - Tricord Home Page

-------------- next part --------------
HTML attachment scrubbed and removed

More information about the samba-technical mailing list