Corrupted Excel files, oplock_break(905) errors

Nicolas Williams Nicolas.Williams at
Thu Oct 21 19:38:49 GMT 1999

I've posted here about this problem before.

The problem has to do with Windows clients abandoning an existing TCP
connection to the SMB server due to a timeout (the threshold is 45
seconds), then re-connecting to the server.

Now, with Samba what happens is that the old smbd, for whatever reason,
hangs around and neither it nor the kernel realize that its TCP
connection to the client is dead, so that the old smbd sleeps waiting
for input from the client.

Meantime, the client reconnected and a new smbd starts and the the
client attempts to re-establish the locks, oplocks, share modes that it
had held prior to reconnecting and the new smbd may wait for those locks
to be given up (by the old smbd) or, in the case of oplocks, it will
send an oplock_break to the old smbd (but the old smbd will not catch
the oplock_break as it is sleeping).

The solution that I use is as follows:

 - set the kernel SO_KEEPALIVE timer to 10 minutes (instead of the
   default 2 hours)

 - set the Samba 'keepalive' config parameter to 5 minutes

 - use the 'root preexec' and 'root postexec' Samba config parameters
   with a script that detects and kills old, stale smbd processes when
   clients reconnect. When a stale smbd is killed it releases all
   locks/oplocks/share modes and the new smbd can proceed.

I've posted about this to this list twice before.

It's becoming a FAQ.

I've still not seen a complete, correct analysis of why the Solaris
kernel and smbd fail to notice the dead TCP connection and myself and
others have speculated here before about the source of the bug (NT?
Solaris?). At any rate, the preexec/postexec stale smbd detector script
that I use does the trick.

-DISCLAIMER: an automatically appended disclaimer may follow. By posting-
-to a public e-mail mailing list I hereby grant permission to distribute-
-and copy this message.-

This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.  The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message which arise as a result of e-mail transmission.  If 
verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities or 
related financial instruments.

More information about the samba-technical mailing list