What a smbc_new_context timeout does and is there a way to change it?

Jeremy Allison jra at samba.org
Tue Dec 15 19:05:41 UTC 2015

On Wed, Dec 09, 2015 at 03:08:52PM +0100, Vladimir Marek wrote:
> Hi,
> we have a customer who reports that sometimes his smbget processes fail
> with error message:
> Can't read 32768000 bytes at offset 7700480000, file smb://...
> I have traced it to a timeout in smbc_free_context in
> source3/libsmb/libsmb_context.c
> smbc_new_context(void)
> {
> ...
> smbc_setTimeout(context, 20000);
> ...
> This happens for samba 3.6, but I believe that the same code is used in
> samba 4.
> If I increase the timeout the problems with smbget go away.
> I would like to ask for help
> a) what is this timeout doing?
> I have suspicion that it's related to network operations and since
> customer is transferring huge amounts of data the network might be
> saturated.

Yes, it times out the connection after that number of msec.

> b) Is there a way to modify this timeout without touching the code, ie.
> from configuration file? I haven't been able to find a way - I believe
> it's set to be 20 seconds.

No, you'll need to modify the code.

> c) If we accept that the way to fix the problem is to increase the
> timeout, what would be the preferred way to do it? Just increase the
> number? Make it configurable? I don't know how difficult is to add
> configuration variable.

I would add a command line parameter, say '-t timeout' (in seconds)
to smbget, then just pass that into smbc_setTimeout().


More information about the samba-technical mailing list