Latest Desktop app is crashing during first sync

Crash after update to Windows Desktop 3.7.3

I just updated to Windows Desktop Client versoin 3.7.3.45121. I think I was on 3.5.something before this.

I rebooted after the update, and now the client fails to start. More precisely, it starts up, apparently starts to sync, then crashes.

Nextcloud version (eg, 20.0.5): Desktop Client 3.7.3.45121
Operating system and version (eg, Ubuntu 20.04): Windows 11 22H2 Build 22621.1194

I just updated to Windows Desktop Client versoin 3.7.3.45121. I think I was on 3.5.something before this.

I rebooted after the update, and now the client fails to start. More precisely, it starts up, apparently starts to sync, then crashes.
The issue you are facing:

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

Steps to replicate it:

  1. Update to Nextcloud Desktop Client 3.7.3
  2. Reboot
  3. Start Nextcloud Desktop Client

The output of your Nextcloud log in Admin > Logging:
Nextcloud crashes before I can access the menus
I found a log file in %APPDATA%\Roaming\Nextcloud\logs, but it is 52 megabytes in size. I have pasted in the last few lines of the file below. I should note that the file it’s complaining about is related to a conflict resolution that was acting bizarrely previously. The conflict resolution dialog appeared to work but actually had no effect.

I was only able to resolve the conflict by actually deleting the original (older) file and replacing it with the newer (conflict) file. Further, that wasn’t easy to do that - the original older file was marked readonly and I had to remove the readonly flag in order to actually kill it off.

I see from the log file that the file is marked readonly on the server. How did this happen? Is there some easy way to clear this flag?

2023-02-13 16:58:01:278 [ warning nextcloud.gui.activity C:\Users\sysadmin\AppData\Local\Temp\windows-13808\client-building\desktop\src\gui\tray\usermodel.cpp:743 ]:	Item  "Documents/_TMT/AM6442/Arago/AM6442_AragoBuild_AM64x_SK.docx"  retrieved resulted in  "Not allowed to upload this file because it is read-only on the server, restoring; Restoration Failed: Cannot remove source file"
2023-02-13 16:58:01:278 [ warning nextcloud.gui.activity C:\Users\sysadmin\AppData\Local\Temp\windows-13808\client-building\desktop\src\gui\tray\usermodel.cpp:710 ]:	Item  "Documents/_TMT/AM6442/Arago/AM6442_AragoBuild_AM64x_SK.docx"  retrieved resulted in error  "Not allowed to upload this file because it is read-only on the server, restoring; Restoration Failed: Cannot remove source file"
2023-02-13 16:58:01:278 [ info nextcloud.gui.activity C:\Users\sysadmin\AppData\Local\Temp\windows-13808\client-building\desktop\src\gui\tray\activitylistmodel.cpp:555 ]:	Error successfully added to the notification list:  "Documents/_TMT/AM6442/Arago/AM6442_AragoBuild_AM64x_SK.docx" "Not allowed to upload this file because it is read-only on the server, restoring; Restoration Failed: Cannot remove source file" OCC::SyncResult::Undefined OCC::SyncFileItem::SoftError
2023-02-13 16:58:01:280 [ warning nextcloud.sync.filesystem C:\Users\sysadmin\AppData\Local\Temp\windows-13808\client-building\desktop\src\common\filesystembase.cpp:209 ]:	Renaming temp file to final failed:  "WindowsError: 5: Access is denied."
2023-02-13 16:58:01:280 [ warning nextcloud.sync.propagator.download C:\Users\sysadmin\AppData\Local\Temp\windows-13808\client-building\desktop\src\libsync\propagatedownload.cpp:1252 ]:	"Rename failed: C:/Users/brad/Nextcloud/Documents/_TMT/AM6442/Arago/.AM6442_AragoBuild_AM64x_SK.docx.~6b60 => C:/Users/brad/Nextcloud/Documents/_TMT/AM6442/Arago/AM6442_AragoBuild_AM64x_SK.docx"
2023-02-13 16:58:01:280 [ info nextcloud.gui.lockwatcher C:\Users\sysadmin\AppData\Local\Temp\windows-13808\client-building\desktop\src\gui\lockwatcher.cpp:37 ]:	Watching for lock of "C:/Users/brad/Nextcloud/Documents/_TMT/AM6442/Arago/AM6442_AragoBuild_AM64x_SK.docx" being released
2023-02-13 16:58:01:280 [ fatal default C:\Users\sysadmin\AppData\Local\Temp\windows-13808\client-building\desktop\src\libsync\owncloudpropagator.cpp:226 ]:	ENFORCE: "_state != Finished" in file C:\Users\sysadmin\AppData\Local\Temp\windows-13808\client-building\desktop\src\libsync\owncloudpropagator.cpp, line 226

I found this content in Windows Event Viewer:

Faulting application name: nextcloud.exe, version: 3.7.3.45121, time stamp: 0x63e56468
Faulting module name: nextcloud_csync.dll, version: 0.0.0.0, time stamp: 0x63e55ff8
Exception code: 0xc0000005
Fault offset: 0x000000000001be80
Faulting process id: 0x0xAA0
Faulting application start time: 0x0x1D9400F5D5E8B4F
Faulting application path: C:\Program Files\Nextcloud\nextcloud.exe
Faulting module path: C:\Program Files\Nextcloud\nextcloud_csync.dll
Report Id: b3d8a952-2a71-4a56-a1ab-7299573f774d
Faulting package full name: 
Faulting package-relative application ID: 

Additional info. I found a suggestion in the forums to use occ to do a scan.

Following the tip there, I did

docker exec -it --user www-data nextcloud php occ files:scan --all

I get a rather verbose error about a lock during one user’s (happens to be me) scan:

Starting scan for user 1 out of 16 (brad)
Exception during scan: "files/ff913fa6ce88e68561a2e7fa577d7a3d"("home::brad::scanner::") is locked, existing lock on file: exclusive
#0 /var/www/html/lib/private/Files/Storage/Common.php(753): OC\Lock\MemcacheLockingProvider->acquireLock('files/ff913fa6c...', 2, 'home::brad::sca...')
#1 /var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php(591): OC\Files\Storage\Common->acquireLock('scanner::', 2, Object(OC\Lock\MemcacheLockingProvider))
#2 /var/www/html/lib/private/Files/Cache/Scanner.php(334): OC\Files\Storage\Wrapper\Wrapper->acquireLock('scanner::', 2, Object(OC\Lock\MemcacheLockingProvider))
#3 /var/www/html/lib/private/Files/Utils/Scanner.php(262): OC\Files\Cache\Scanner->scan('', true, 3)
#4 /var/www/html/apps/files/lib/Command/Scan.php(143): OC\Files\Utils\Scanner->scan('/brad', true, NULL)
#5 /var/www/html/apps/files/lib/Command/Scan.php(199): OCA\Files\Command\Scan->scanFiles('brad', '/brad', Object(Symfony\Component\Console\Output\ConsoleOutput), false, true, false)
#6 /var/www/html/3rdparty/symfony/console/Command/Command.php(255): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /var/www/html/core/Command/Base.php(168): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /var/www/html/3rdparty/symfony/console/Application.php(1009): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /var/www/html/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /var/www/html/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /var/www/html/lib/private/Console/Application.php(211): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /var/www/html/console.php(99): OC\Console\Application->run()
#13 /var/www/html/occ(11): require_once('/var/www/html/c...')
#14 {main}

I ran the scan again and the error remained. I rebooted the Nextcloud server and the error remains.

I’m not quite clear on how to proceed and don’t want to just start lobbing occ hand grenades without knowing what I’m doing.

Any tips would be appreciated.

Thanks,
Brad

PROBLEM RESOLVED - WORKAROUND FOUND

PART 1

Following the script from user zisuu about 2/3 of the way down this page, I was able to resolve the lock. The desktop client is now working fine.

My script was slightly different from zisuu’s since I use docker. My command sequence looked like this:

docker exec -it --user www-data nextcloud php occ files:scan --all
docker exec -it --user www-data nextcloud php occ files:cleanup
docker exec -it --user www-data nextcloud php occ maintenance:mode --on
docker exec -it --user root nextcloud-mariadb mysql -u root -p'<DatabaseRootPassword>' -D nextcloud -e 'delete from oc_file_locks where 1'
docker exec -it --user www-data nextcloud php occ maintenance:mode --off

then I rebooted the server.

PART 2

HOWEVER,

I am now back to the original problem, which is a conflict that refuses to resolve. I tried to tell it that I want the local version of the file, and it simply won’t allow it.

I notice that the server version of the file, once it is downloaded to me again, is marked readonly.
And when I try to replace it with the local version, the conflict arises again.

I even tried to

  • Let it restore the server version
  • Clear the readonly flag
  • Let it sync
  • Then overwrite with the local version.

That led to the same result.

Finally I tried what I had seen someone else suggest, which is to

  • Create a new folder
  • Move all the contents of the folder with the problem file into it (except for the offending file)
  • Blow away the old folder.

Now both the file scan on the server, and the sync on the desktop client, are successful.