Webdav upload fast but hangs at 99% until it eventually finishes

Nextcloud version: 20.0.4
Operating system and version: Ubuntu 20.04
Apache or nginx version: Apache/2.4.41
PHP version : 7.4

The issue you are facing:
Every time I transfer a file using the Nextcloud WebDAV the file transfer is quick but hangs at 99% until it eventually finishes. I have discovered that it hangs for a different amount of time depending on the filesize. I have no idea why it is doing this or if this is supposed to be happening. Here is a video. How do I fix this?

The output of your Nextcloud log in Admin > Logging:

Error: Trying to access array offset on value of type null at /var/www/nextcloud.example.com/apps/dav/lib/CalDAV/BirthdayService.php#304
/var/www/nextcloud.example.com/apps/dav/lib/CalDAV/BirthdayService.php - line 304:

OC\Log\ErrorHandler::onError()

/var/www/nextcloud.example.com/apps/dav/lib/BackgroundJob/GenerateBirthdayCalendarBackgroundJob.php - line 71:

OCA\DAV\CalDAV\BirthdayService->resetForUser()

/var/www/nextcloud.example.com/lib/private/BackgroundJob/Job.php - line 52:

OCA\DAV\BackgroundJob\GenerateBirthdayCalendarBackgroundJob->run()

/var/www/nextcloud.example.com/lib/private/BackgroundJob/QueuedJob.php - line 46:

OC\BackgroundJob\Job->execute()

/var/www/nextcloud.example.com/cron.php - line 149:

OC\BackgroundJob\QueuedJob->execute()

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

<?php
$CONFIG = array (
  'instanceid' => '',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' =>
  array (
    0 => 'nextcloud.example.com',
  ),
  'datadirectory' => '/var/www/nextcloud.example.com/data',
  'dbtype' => 'mysql',
  'version' => '20.0.4.0',
  'overwrite.cli.url' => 'http://nextcloud.example.com',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'User',
  'dbpassword' => 'Password',
  'installed' => true,
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
);

Not sure if the logs are related to your problem. Can you check the usage of your system when you upload a file? Like top and iotop? Could be something with the database or some copying between file systems…

Every time I upload a file to the WebDAV the process /usr/sbin/apache2 -k start uses a lot of my CPU, But I have no idea what that means. The problem only appears when I’m uploading something from the WebDAV and the online upload works as intended.

So you mean directly with webdav or with the Nextcloud client? Or both?

I’m sorry I meant to say when I’m uploading something to the WebDAV from my pc

Did you manage to solve this problem? I’ve got the same issue on my instance and have been scratching my head over it all day.
Does the issue persist when uploading multiple files (i.e pause for a period at the end of each file)?

I wish I had a the solution but I’m still experiencing it. And the issue indeed persist when I’m uploading multiple files.

Well for me it is still not clear, what software do you use for upload, native windows network drive (which windows) or drive mount via mountainduck, web drive or similar?

Question is then, with different software (winscp, Nextcloud client) or direct browser upload, do you see the same problem?

In my case I have mapped NC as a network drive within Windows 10.

Using the browser to upload directly appears to be better, roughly constant 10mb/s upload. Not had a chance to test the Nextcloud client, but will do tomorrow. It is intended to use mountainduck in the long terrm anyway.

I am using a LVM logical volume to host my data directory, although I achieve write speads of 130mbs directly, could this be causing an issue with NC?

I don’t see any errors present in logging either. One I’ve done more investigation I should probably create a separate thread with all the details etc

Edit to add: I have also enabled redis file locking and made some SQL tweaks as suggested elsewhere on the forums but this has had no effect

I am too facing the same issue. I have also created a forum post regarding it. No solution yet.

Although the WEBDAV works properly with cyberduck but with windows it behaves as mentioned.

Mee too.

But also, the upload/download goes okay till suddenly the speed drops to nearly zero. I have updated from 19 to 21 but the issue still persists.

Running Nextcloud on a Proxmox container over ZFS.

This is normal behavior and has NOTHING to do with nextcloud. Your webdav client (windoze) is doing that. What its doing is sending the file to a local cache, which happens really fast and shows fast transfer progress. It then sits there for a while when it synchronizes the cache to webdav (I.e., it does the ACTUAL upload).

So either pick a better webdav client, or live with it.

What webdav client would you recommend?

No idea, I don’t use windows.

But like I said, this behavior doesn’t actually change anything, it’s just disconcerting if you don’t understand what’s going on behind the scenes.

I think WinSCP supports webdav as well, if not check out some other file transfer programs (filezilla, total commander, …)