Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The process cannot access the file because it is being used by another process #4502

Open
4 of 8 tasks
rajendradewani opened this issue May 7, 2022 · 4 comments
Open
4 of 8 tasks
Labels
0. Needs triage bug feature: 🔄 sync engine hotspot: connectivity errors Transient network, server, authentication, and related error handling

Comments

@rajendradewani
Copy link

⚠️ Before submitting, please verify the following: ⚠️

Bug description

I am using Windows 10, NextCloud 3.5.0

NextCloud will not upload files being used by uTorrent/BitTorrent - Completed folder.
“The process cannot access the file because it is being used by another process.”

Nextcloud will remove the files on failed to upload.

Steps to reproduce

NextCloud client is using virtual file links.

I have set up uTorrent/BitTorrent to download files.

New files get downloaded to c:\Pending\Tutorial
on complete, the files will be moved to c:\Nextcloud_DONE/downloads\

Nextcloud will notice new files added and will attempt to upload but it will throw the following message

“The process cannot access the file because it is being used by another process.”
uTorrent / BitTorrent app has copied in the file after download but is still reading it to share with other users.

Logs.
2022-05-06 08:57:06:777 [ debug nextcloud.sync.database.sql C:\Users\sysadmin\AppData\Local\Temp\2\windows-10062\client-building\desktop\src\common\ownsql.cpp:295 ] [ OCC::SqlQuery::exec ]: SQL exec “SELECT path, inode, modtime, type, md5, fileid, remotePerm, filesize, ignoredChildrenRemote, contentchecksumtype.name || ‘:’ || contentChecksum, e2eMangledName, isE2eEncrypted, lock, lockOwnerDisplayName, lockOwnerId, lockType, lockOwnerEditor, lockTime, lockTimeout FROM metadata LEFT JOIN checksumtype as contentchecksumtype ON metadata.contentChecksumTypeId == contentchecksumtype.id WHERE phash=?1”
2022-05-06 08:57:06:778 [ debug nextcloud.sync.database.sql C:\Users\sysadmin\AppData\Local\Temp\2\windows-10062\client-building\desktop\src\common/ownsql.h:145 ] [ OCC::SqlQuery::bindValue ]: SQL bind 1 8052429941439445994
2022-05-06 08:57:06:778 [ debug nextcloud.sync.database.sql C:\Users\sysadmin\AppData\Local\Temp\2\windows-10062\client-building\desktop\src\common\ownsql.cpp:295 ] [ OCC::SqlQuery::exec ]: SQL exec “SELECT path, inode, modtime, type, md5, fileid, remotePerm, filesize, ignoredChildrenRemote, contentchecksumtype.name || ‘:’ || contentChecksum, e2eMangledName, isE2eEncrypted, lock, lockOwnerDisplayName, lockOwnerId, lockType, lockOwnerEditor, lockTime, lockTimeout FROM metadata LEFT JOIN checksumtype as contentchecksumtype ON metadata.contentChecksumTypeId == contentchecksumtype.id WHERE phash=?1”
2022-05-06 08:57:06:778 [ warning nextcloud.gui.activity C:\Users\sysadmin\AppData\Local\Temp\2\windows-10062\client-building\desktop\src\gui\tray\usermodel.cpp:631 ]: Item “_DONE/downloads/Tutorial001/Tutorial-Sample-Video.mkv” retrieved resulted in “The process cannot access the file because it is being used by another process.”
2022-05-06 08:57:06:778 [ warning nextcloud.gui.activity C:\Users\sysadmin\AppData\Local\Temp\2\windows-10062\client-building\desktop\src\gui\tray\usermodel.cpp:607 ]: Item “_DONE/downloads/Tutorial001/Tutorial-Sample-Video.mkv” retrieved resulted in error “The process cannot access the file because it is being used by another process.”
2022-05-06 08:57:06:778 [ info nextcloud.gui.activity C:\Users\sysadmin\AppData\Local\Temp\2\windows-10062\client-building\desktop\src\gui\tray\activitylistmodel.cpp:546 ]: Error successfully added to the notification list: “The process cannot access the file because it is being used by another process.”
2022-05-06 08:57:06:783 [ debug nextcloud.sync.database.sql C:\Users\sysadmin\AppData\Local\Temp\2\windows-10062\client-building\desktop\src\common/ownsql.h:145 ] [ OCC::SqlQuery::bindValue ]: SQL bind 1 -8787998027952910409

Expected behavior

NextCloud should be able to upload it and should not throw any errors.
NextCloud sync app should be able to read a file that is being read by another app.
...
Files should get uploaded no matter if it is being read by any application including (Bittorrent/uTorrent).
NextCloud should not remove the file if any other process is using it.

Which files are affected by this bug

mkv

Operating system

Windows

Which version of the operating system you are running.

Windows 10

Package

Distro package manager

Nextcloud Server version

24.0.0 on Linux 5.13.0-40-generic x86_64

Is this bug present after an update or on a fresh install?

Fresh desktop client install

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

Are you using an external user-backend?

  • Default internal user-backend
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Nextcloud Server logs

No response

Additional info

No response

@joshtrichards
Copy link
Member

Hi @rajendradewani - This is not a bug in the Nextcloud client. It's possible to create a lock that prevents any sharing (i.e. opening of the file) by another process - even just for reading. It sounds like the other application is doing that.

@joshtrichards joshtrichards closed this as not planned Won't fix, can't repro, duplicate, stale Nov 22, 2023
@Taudris
Copy link

Taudris commented Dec 2, 2023

The client should wait until the lock is released before syncing the file. It should not produce "could not be synced due to an error" notifications for this case, either (or at least, notifications with this specific cause should be able to be toggled off).

@joshtrichards
Copy link
Member

NextCloud should not remove the file if any other process is using it.

@rajendradewani Apologies as I just re-read and noticed the above part, which would be unexpected behavior.

Can you clarify what you mean by the file is being removed? From your local filesystem? From the server? Can you provide some evidence that the client is deleting it? That does sound wrong.

@Taudris
Copy link

Taudris commented Dec 3, 2023

I'm not the original poster, and I'm not having the exact same issue they're having with files being deleted, but I did find the same error message in the log ("The process cannot access the file because it is being used by another process."), so I figured OP's issue and mine could have a similar root cause.

My issue is that I get spammed with Windows notifications from the Nextcloud desktop client saying "could not be synced due to an error" in a couple of use cases:

  1. Creating a backup of my Lightroom catalog in my Nextcloud folder (I forget what happens if I put the catalog itself on Nextcloud directly)
  2. Using Visual Studio 2022 to open a C# project/solution stored in my Nextcloud folder - a notification pops up something like a few times a minute as I'm making code changes

I also just found a really easy-to-reproduce behavior using Notepad++ v8.6. Save a file into the Nextcloud folder, switch away for a couple seconds or so, then switch back. If you switched slowly enough, you'll get a popup saying "This file has been modified by another program, would you like to reload it?" When you reload it, there are no observable changes. This should absolutely not be happening.

I'm using Windows 11 23H2 build 22631.2715 with Nextcloud desktop client version 3.10.1. The Lightroom problems have persisted through numerous client versions. I only recently discovered the VS and N++ problems.

@joshtrichards joshtrichards changed the title [Bug]: youtube.com/watch?v=ap8xt1Ds7_4 The process cannot access the file because it is being used by another process The process cannot access the file because it is being used by another process Aug 16, 2024
@joshtrichards joshtrichards added the hotspot: connectivity errors Transient network, server, authentication, and related error handling label Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage bug feature: 🔄 sync engine hotspot: connectivity errors Transient network, server, authentication, and related error handling
Projects
None yet
Development

No branches or pull requests

3 participants