Download fails with "Connection lost" (sync) or "Download failed" (browser) randomly

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 12.0.2): 16.0.1
Operating system and version (eg, Ubuntu 17.04): OpenSUSE 15.1
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.33
PHP version (eg, 7.1): 7.3
Hardware: Raspberry Pi 3B+

The issue you are facing:
The download is cut randomly and fails both in sync and browser. No errors are produced. I can upload files without any problems.
I suspect it’s fpm settings, or fcgid settings. I’m posting everything, including redis settings. :slight_smile: I really need help.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

The output of your Nextcloud log in Admin > Logging: No errors

PASTE HERE

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'Removed',
  'passwordsalt' => 'Removed',
  'secret' => 'Removed',
  'trusted_domains' => 
  array (
    0 => 'Removed',
    1 => '192.168.73.6',
  ),
  'datadirectory' => '/Cloud/CloudDATA',
  'overwrite.cli.url' => 'Removed',
  'version' => '16.0.1.1',
  
  'dbtype' => 'mysql',
  'dbname' => 'Removed',
  'dbhost' => 'localhost:6389',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'Removed',
  'dbpassword' => 'Removed',
  'mysql.utf8mb4' => true,
 
  'default_language' => 'en',
  'default_locale' => 'en_US',
  'defaultapp' => 'files',
  'knowledgebase' => 'true',
  'allow_user_to_change_display_name' => true,
 
  'installed' => true,
  'maintenance' => false,
  'loglevel' => 2,

  'updater.release.channel' => 'stable',
  'theme' => '',
  
  'overwritehost' => 'Removed',
  'overwriteprotocol' => 'https',
  'overwritewebroot' => '/',
  'htaccess.RewriteBase' => '/',

  'proxy' => '',
  'trusted_proxies' => 
  array (
    0 => '127.0.0.1',
  ),

  'login_form_autocomplete' => false,
  'filelocking.enabled' => true,
  
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  
  'redis' => 
  array (
    'host' => '127.0.0.1',
    'port' => 6379,
    'timeout' => 0,
  ),
  
  'twofactor_enforced' => 'true',
  'twofactor_enforced_groups' => 
  array (
  ),
  'twofactor_enforced_excluded_groups' => 
  array (
  ),
  
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  
  'app_install_overwrite' => 
  array (
    0 => 'calendar',
  ),
  
  'data-fingerprint' => 'Removed',
  'appcodechecker' => true,

);

The output of your Apache/nginx/system log in /var/log/____:No errors


fpm.conf

[global]
error_log = /var/log/php-fpm.log
include=/etc/php7/fpm/php-fpm.d/*.conf

php-fpm.d/www.conf

[www]
user = wwwrun
group = www

listen = /var/run/phpfpm.sock

listen.owner = wwwrun
listen.group = www
listen.mode = 0660

pm = dynamic
pm.max_children = 35
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35

pm.process_idle_timeout = 7200s
pm.max_requests = 200

php_admin_value[memory_limit] = 512M

redis.conf

bind 127.0.0.1
protected-mode yes
port 6379
tcp-backlog 511
unixsocket /tmp/redis.sock
unixsocketperm 770
timeout 0
tcp-keepalive 300
daemonize yes
supervised systemd
pidfile /var/run/redis/6379.pid
loglevel notice
logfile /var/log/redis/6379.log
databases 16
always-show-logo yes
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error no
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /var/redis/6379/
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
maxclients 512
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
slave-lazy-flush no
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble no
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes

php.ini

[PHP]
engine = On
short_open_tag = Off
precision = 14
output_buffering=off
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func =
serialize_precision = -1
disable_functions =
disable_classes =
zend.enable_gc = On
expose_php = On
max_execution_time = 3600
max_input_time = 3600
memory_limit = 512M
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
html_errors = On
variables_order = "GPCS"
request_order = "GP"
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 200G
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
default_charset = "UTF-8"
include_path = ".:/usr/share/php7:/usr/share/php7/PEAR"
doc_root =
user_dir =
enable_dl = Off
file_uploads = On
upload_max_filesize = 200G
max_file_uploads = 200
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 3600
cli_server.color = On
date.timezone = 'UTC'
pdo_mysql.cache_size = 2000
pdo_mysql.default_socket=
smtp_port = 25
mail.add_x_header = Off
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1
ibase.allow_persistent = 1
ibase.max_persistent = -1
ibase.max_links = -1
ibase.timestampformat = "%Y-%m-%d %H:%M:%S"
ibase.dateformat = "%Y-%m-%d"
ibase.timeformat = "%H:%M:%S"
mysqli.max_persistent = -1
mysqli.allow_persistent = Off
mysqli.max_links = -1
mysqli.cache_size = 2000
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off
mysqlnd.collect_statistics = On
mysqlnd.collect_memory_statistics = Off
bcmath.scale = 0
session.save_handler = files
session.save_path = "/var/lib/php7"
session.use_strict_mode = 0
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 3600
session.referer_check =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.sid_length = 26
session.trans_sid_tags = "a=href,area=href,frame=src,form="
session.sid_bits_per_character = 5
zend.assertions = -1
mbstring.func_overload = 0
tidy.clean_output = Off
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=86400
soap.wsdl_cache_limit = 5
ldap.max_links = -1
always_populate_raw_post_data=off

apache settings:
default-server.conf

DocumentRoot "/srv/www/nextcloud"
ServerName cloud.evolozzy.net

<Directory "/srv/www/nextcloud">
	Options All MultiViews
	AllowOverride All
	<IfModule !mod_access_compat.c>
		Require all granted
	</IfModule>
	<IfModule mod_access_compat.c>
		Order allow,deny
		Allow from all
	</IfModule>
</Directory>

Alias /icons/ "/usr/share/apache2/icons/"
<Directory "/usr/share/apache2/icons">
	Options FollowSymlinks Indexes MultiViews
	AllowOverride None
	<IfModule !mod_access_compat.c>
		Require all granted
	</IfModule>
	<IfModule mod_access_compat.c>
		Order allow,deny
		Allow from all
	</IfModule>
</Directory>

ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/"
<Directory "/srv/www/cgi-bin">
	AllowOverride None
	Options +ExecCGI -Includes
	<IfModule !mod_access_compat.c>
		Require all granted
	</IfModule>
	<IfModule mod_access_compat.c>
		Order allow,deny
		Allow from all
	</IfModule>
</Directory>

<IfModule mod_userdir.c>
	UserDir public_html
	Include /etc/apache2/mod_userdir.conf
</IfModule>

IncludeOptional /etc/apache2/conf.d/php7.conf
IncludeOptional /etc/apache2/conf.d/mod_fcgid.conf

IncludeOptional /etc/apache2/conf.d/apache2-manual?conf

vhosts.d/nextcloud.conf

<VirtualHost *:80>
    ServerAdmin Removed
    ServerName Removed
    DocumentRoot /srv/www/nextcloud

    ErrorLog /var/log/apache2/Removed-error_log
    CustomLog /var/log/apache2/Removed-access_log combined

    HostnameLookups Off
    UseCanonicalName Off
    ServerSignature On
    
    Include /etc/apache2/conf.d/php7.conf
    
    ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/"
    <Directory "/srv/www/cgi-bin">
        AllowOverride None
        Options +ExecCGI -Includes
        <IfModule !mod_access_compat.c>
            Require all granted
        </IfModule>
        <IfModule mod_access_compat.c>
            Order allow,deny
            Allow from all
        </IfModule>
    </Directory>

    <IfModule mod_userdir.c>
        UserDir public_html
        Include /etc/apache2/mod_userdir.conf
    </IfModule>

    <Directory "/srv/www/nextcloud">

        Options Indexes Includes FollowSymLinks ExecCGI MultiViews
        AllowOverride All

        <IfModule !mod_access_compat.c>
            Require all granted
        </IfModule>
        <IfModule mod_access_compat.c>
            Order allow,deny
            Allow from all
        </IfModule>
    </Directory>

    <Proxy "unix:/var/run/phpfpm.sock|fcgi://php-fpm"> 
        ProxySet disablereuse=off 
    </Proxy> 
    <FilesMatch \.php$> 
        SetHandler proxy:fcgi://php-fpm 
    </FilesMatch> 
    
    RewriteEngine on
    RewriteCond %{SERVER_NAME} =Removed
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

</VirtualHost>


<IfDefine SSL>
<IfDefine !NOSSL>

<VirtualHost _default_:443>
        #ProxyPassMatch ^/(.*\.php(/.*)?)$ unix:/run/phpfpm.sock|fcgi://localhost/srv/www/nextcloud/
	#php_value memory_limit 512M
	
	DocumentRoot "/srv/www/nextcloud"
	
	ServerName Removed:443
	ServerAdmin Removed

	ServerAlias Removed
	SSLCertificateFile /etc/letsencrypt/live/Removed/fullchain.pem
	SSLCertificateKeyFile /etc/letsencrypt/live/Removed/privkey.pem
	Include /etc/letsencrypt/options-ssl-apache.conf
	
	<Directory /var/www/html/nextcloud/>
		Options +FollowSymlinks
		AllowOverride All

		<IfModule mod_dav.c>
			Dav off
		</IfModule>

		SetEnv HOME /srv/www/nextcloud
		SetEnv HTTP_HOME /var/www/nextcloud
	</Directory>

	<IfModule mod_headers.c>
		Header set Feature-Policy: "accelerometer 'none'; ambient-light-sensor 'none'; autoplay 'none'; camera 'none'; fullscreen 'self'; geolocation 'none'; microphone 'none'; midi 'none'; payment 'none'; picture-in-picture 'none'; sync-xhr 'none'; usb 'none'"
	</IfModule>

</VirtualHost>

SSLStaplingResponderTimeout 5
SSLStaplingReturnResponderErrors off
SSLStaplingCache shmcb:/var/run/ocsp(128000)

</IfDefine>
</IfDefine>

conf.d/php7.conf

<IfModule mod_php7.c>
       <FilesMatch "\.ph(p[345]?|tml)$">
           SetHandler application/x-httpd-php
       </FilesMatch>
       <FilesMatch "\.php[345]?s$">
           SetHandler application/x-httpd-php-source
       </FilesMatch>
        DirectoryIndex index.php4
        DirectoryIndex index.php5
        DirectoryIndex index.php
</IfModule>

conf.d/mod_fcgid.conf

<IfModule fcgid_module>

FcgidIPCDir /var/lib/apache2/fcgid/

FcgidProcessTableFile /var/lib/apache2/fcgid/shm

</IfModule>

Loaded Apache modules:

Loaded Modules:
 core_module (static)
 so_module (static)
 http_module (static)
 mpm_prefork_module (static)
 unixd_module (static)
 systemd_module (static)
 actions_module (shared)
 alias_module (shared)
 autoindex_module (shared)
 dir_module (shared)
 env_module (shared)
 include_module (shared)
 mime_module (shared)
 setenvif_module (shared)
 rewrite_module (shared)
 headers_module (shared)
 access_compat_module (shared)
 socache_memcache_module (shared)
 ssl_module (shared)
 dbd_module (shared)
 unique_id_module (shared)
 php7_module (shared)
 socache_shmcb_module (shared)
 log_config_module (shared)
 proxy_module (shared)
 cgi_module (shared)
 fcgid_module (shared)
 authz_core_module (shared)
 proxy_fcgi_module (shared)

PHP modules

[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
fileinfo
filter
gd
hash
iconv
imagick
intl
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
posix
redis
Reflection
session
SimpleXML
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tidy
tokenizer
uuid
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

Seems just like my problem.

Can you download a single large file without interruption?

It looks like the same problem yes. I can’t download a single large file without interruption. Have you tried a fresh install?

There was another post about a similar problem, said they’ve changed their router and it fixed the problem.

I’m running my router at home, changed a couple of settings that might interfere with the connection and interrupt it, which solved my problems, just now. I hope you find a solution.

That’s interesting. I am using a Fritzbox and can’t think of an option that might affect local connections in that way. Were you trying to access your nextcloud from within your local network? If yes, what changes did you do to your router configuration?

I will be sending a message with details.