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

Sorry to say, but I give up.

I spend half my time trying to recover from these kinds of errors.

Maybe instead of building a backup with every conceivable option, the devs should focus on stability and reliability.

This product is neither.

The one that stops this issue (assuming that it refers to a source file) is snapshot-policy.

You are presumably on Windows, and “used by another process” is raised by Windows.
If you like, send the topic title here to a search engine, and optionally add “VSS” as well.
A Duplicati snapshot is Windows VSS.

If you mean this specific one, forum search box shows no previous mention of it by you.
If you mean other errors reading files, there can be various ones, e.g. from permissions.

Duplicati.WindowsService.exe can help with both issues, as Administrator privileges are
required for VSS snapshots (Windows rule), and a Windows service has great access…

Unfortunately setting up the Windows service is currently manual, not an installer option.

Sorry to hear that. I’m not sure what you see. You posted just once before over past year.

EDIT:

I will say Duplicati is definitely NOT bug-free, but it’s limited by what its volunteers can do.
If anybody would like to assist in any way, volunteers are who keep the project continuing.

Official Issues list is one place for developers to start, but there’s plenty of room for others
including those willing to test and at least document how to reproduce any stability issues.
That’s a big help to volunteers who might then be able to code the fix. See Issue template.

sorry - just blowing off some steam. but I really do have a lot of problems with the 'The process cannot access the file because it is being used by another process" error.

I just assumed duplicati used vss by default and I didn’t see any specific reference to a source file that was opened, so I assumed it was an issue with the duplicati databases.

Can I just confirm the proc to set this up properly?

for duplicati server:

  • setup duplicati windows service (I’ve read the docs on the setup)
  • restart

for each backup config:

  • change the snapshot policy for either auto or required

question:
“Administrator privileges are required for VSS snapshots”

  • I assume this is addressed once duplicati windows service is setup and that I do not need to do anything special when start the duplicati client - is that correct?

I do have another problem with the databases where I can’t rebuild a db, but I suspect part of the problem is the above-mentioned vss. If I can get past this occurring all the time, maybe I’ll be in a better frame of mind…

thx!

The How-To Migrating from User to Service install on Windows (latest recipe is v3) covers doing that.
It’s much simpler if you’re starting from scratch, but presumably you have backups you want to move.

Additionally, your steps would still leave Duplicati’s TrayIcon wrongly thinking it should start its server. Connecting to that would put you at port 8300, not 8200 which service likely got (if it got there first…).

There might be other issues I forgot, so follow the How-To. When at right server, configure snapshots.
About → System info UserName and StartedBy will be clues to which server you got (if it’s not clear).

Windows service by default installs as SYSTEM so has plenty (maybe too much) Administrator power without having to jump through hoops (such as UAC) that ordinary Administrator group would require.

Duplicati GUI is just a web page, so user doesn’t matter any. You would browse directly to the service. Getting TrayIcon client going is kind of complicated, if you have a GUI lock. If you want to do that, ask.
Basically, it needs to get into the server that the service started, and can hit access permission issues.

EDIT:

A full set of service, server, and TrayIcon (with desired --no-hosted-server) would look like image at
[SOLVED] Is it ok that I see 5 processes of Duplicati in Windows Task manager?

Sadly (or maybe gladly if one is security-worried), it runs as you, and even if you were an Administrator there’s no special power until you endure the UAC prompt that Windows will likely want before granting.

I don’t know exactly what you saw, or when. Sometimes About → Show log → Live → Warnings helps.
Maybe test that before converting to the service, if this issue occurs often (and it sounds like it does…).
You can also see if anything is in the job logs, as an error or warning typically has a one-liner put there.

There’s at least one way for the database to interfere with itself. IIRC it involves auto-cleanup such as
Large job stopped halfway. Stuck in loops, either “database is locked” or “No filelists found on the remote destination” EDIT: auto-cleanup bug?

If you don’t set the option, then this wouldn’t be your situation, but the live log check seems worthwhile because it would be best to know what’s going on. If you see a message arrive, clicking may get more.

EDIT:

Google search is seeing some formats of this message where a file is seen after “file”, but not for you?
This makes determining problem more important. If it happens mid-backup, it’s probably on source file.
Database problem would likely be during startup, but maybe only if auto-cleanup option was chosen.

Thx so much for the thorough explanation - I need to go over the migration procedure, but as a suggestion, it would be helpful if this issue was collectively highlighted during the installation so users could elect to go with a vss solution from the start. TBH, migrating to a windows service sounds like a non-trivial project - I guess as long as I know I don;t have access to vss w/ my current install, I can shutd own all relevant apps before I backup - that seems to have resolved the issue I was encountering…

Thx again!

which might still be open because nobody then or now knew how. Developers are very much needed.

It’s lots of steps, but there’s a recipe which hopefully will work fine.

That’s a good test for whether it’s a source file. You also have logs.

To compare symptoms with yours (if you recall), I set snapshot-policy to off (was required) as a test.
Live log was running at Warning level. During backup, it found a locked file, and reported it live, with

Feb 1, 2023 12:20 PM: Failed to process path: <path>

Clicking on that line showed the detail behind failure as:

{“ClassName”:“System.IO.IOException”,“Message”:“The process cannot access the file ‘\\?\C:\<path>’ because it is being used by another process.”

At backup end, a yellow popup (yellow for warning) appeared at bottom of screen, informing that

2023-02-01 12:20:42 -05 - [Warning-Duplicati.Library.Main.Operation.Backup.FileBlockProcessor.FileEntry-PathProcessingFailed]: Failed to process path: <path>

and giving Show and Dismiss buttons. Show button goes to job log, where log for the backup has

2023-02-01 12:20:42 -05 - [Warning-Duplicati.Library.Main.Operation.Backup.FileBlockProcessor.FileEntry-PathProcessingFailed]: Failed to process path: <path>

I have filed an issue to see if at least the summary explanation of the type of failure can also show
however your message seems to give the explanation without the path? Anything else match this?

I don’t think I was getting any warning - just a fail msg. I’ll try running again tonight with an active file in the src dir to see if I get any further detail.

For the moment, if I can consistently get a clean backup (no errs, warnings) after closing all other apps, I’m further ahead than I’ve been in a while.

Once I get to a stable, repeatable process, I’ll start experimenting with the windows service you described above.

Thx for all your advice!

The process to move to a service is really quite easy when using version 3 of the instructions. Follow the instructions in this post, once setup you may have to re-specify some of the paths to be system relative vs user relative, see my post near the end of the thread for details on that.

1 Like

Got it. I’ll give it a shot.

Thx!