server icon indicating copy to clipboard operation
server copied to clipboard

smbclient timeout (download fails) in certain configurations

Open thoschi opened this issue 7 years ago • 4 comments

Steps to reproduce

  1. Use files:external to mount an existing share in your home folger
  2. Download/sync (browser or WebDav) a file that needs > 30 sec to download

Expected behaviour

The file should download.

Actual behaviour

The download fails with an error after approximately 30 seconds.

Server configuration

Operating system: Nextcloud: Ubuntu 18.04.2, kernel 4.15.0-45, smbclient 4.7.6 Fileserver: Ubuntu 16.04 (with backported security patches), kernel 3.13.0-35, smbd 3.6.25

Web server: Apache 2.4.29-1

Database: mysql 14.14

PHP version: php 7.2.15

Nextcloud version: (see Nextcloud admin page) 15.0.4

Updated from an older Nextcloud/ownCloud or fresh install: updated from 13

Where did you install Nextcloud from: https://nextcloud.com/install/

Signing status: No errors have been found.

List of activated apps: Enabled: [...]

  • files: 1.10.0
  • files_external: 1.6.0
  • files_frommail: 0.2.0
  • files_pdfviewer: 1.4.0
  • files_rightclick: 0.11.0
  • files_sharing: 1.7.0
  • files_texteditor: 2.7.0
  • files_trashbin: 1.5.0
  • files_versions: 1.8.0
  • files_videoplayer: 1.4.0 [...]

Client configuration

Browser: Firefox 65.0

Operating system: Ubuntu 18.10, kernel 4.18.0-15

thoschi avatar Feb 24 '19 08:02 thoschi

I already investigated this: the problem is obviously a timeout that occurs in our special configuration (we are yet being forced to use an old fileserver with protocol SMBv1 - we are going to change this asap. The error most probably does not occur in other configurations)

Yet this error is easily resolvable:

The file nextcloud/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php contains the call of smbclient in line 78. In our case there seems to be a hardcoded timeout of 30 Seconds for smbclient connections. Depending on the internet connection, this will drop any larger download with an error.

To resolve the issue, a manual value for timeouts can be set by changing the line to $command = sprintf('%s%s %s %s -t 120 %s', ) (the value after -t can be altered of course) Afterwards the download finishes as it should. So far I observed no side-effects of this change.

Of course this is only a temporary solution and it is possibly reverted by any nextcloud upgrade. Still it might help others facing a similar situation to double-check this setting.

thoschi avatar Feb 24 '19 08:02 thoschi

The problem persists - but the solution has changed: The value for timeout is now set in /opt/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Options.php and can be changed there.

thoschi avatar Jun 07 '19 16:06 thoschi

This is still unfixed in 17.01 The hard coded 20 sec timeout is still unchanged and quite annoying...

thoschi avatar Nov 25 '19 18:11 thoschi

Fixed by https://github.com/nextcloud/server/pull/17258

kesselb avatar Nov 25 '19 19:11 kesselb