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

Config Bug: WinError 32 + WinError 2: Can't rename config file, error & The system cannot find the file specified #949

Closed
redactedscribe opened this issue Jan 16, 2021 · 5 comments
Labels

Comments

@redactedscribe
Copy link
Contributor

redactedscribe commented Jan 16, 2021

Nicotine+ version: 2.3.0.dev1
Operating System/Distribution: Windows 10 20H2

Describe the bug

Can't rename config file, error: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\user\\AppData\\Roaming\\nicotine\\config\\config.new' -> 'C:\\Users\\user\\AppData\\Roaming\\nicotine\\config\\config'
Can't back config file up, error: [WinError 2] The system cannot find the file specified: 'C:\\Users\\user\\AppData\\Roaming\\nicotine\\config\\config' -> 'C:\\Users\\user\\AppData\\Roaming\\nicotine\\config\\config.old'
...
[attempts 5x]

Expected behavior

I have both a config and config.old existing at the attempted path. The config dir those two files exist in is a symbolic link to another location where I store config files (uploaded to the cloud), but I'm fairly certain I encountered this prior to symlinking them with version 2.2.2. Symlinks shouldn't be the cause, and the configs should always be readable/findable.

Steps to reproduce the bug

Run the application.

The configs are automatically backed up to the cloud. I haven't encountered the backing-up software ever locking a file. I can delete a file being synced halfway through a sync for example. I don't think it plays any role but I thought I'd mention it. Apparently it does.

Since quitting the syncing app, I see no more errors. I think this is because Nicotine+ is deleting config.old and the cloud upload fails, then a lock of sorts is happening. If nicotine just overwrote the write rather than deleting it, this may not be an issue, assuming it's not already doing so.

It's certainly a conflict between the cloud syncing app and Nicotine+, as when both happen to want access at the same time, the bug is occurring. I guess I'll have to manually backup Nicotine+ config files. This can be closed if deemed not a bug.

@mathiascode
Copy link
Member

Can you check if this build improves the situation? https://github.com/mathiascode/nicotine-plus/actions/runs/490450158

@redactedscribe
Copy link
Contributor Author

redactedscribe commented Jan 16, 2021

The several times that I ran this build the only error produced now was:

21:26:18 Can't back config file up, error: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\user\\AppData\\Roaming\\nicotine\\config\\config'

And at max, two consecutive errors were shown in the log.

After more testing, the error was happening every time with the cloud sync app open, but now isn't. Since this build, the syncer doesn't seem to try to immediately sync the config files as soon as Nicotine+ opens (not sure why that's different, maybe the way you're now writing the files). The error occurs sporadically, even though it was happening repeatedly at first with this new build. It's a bit hard to track down if there's an improvement, but WinError 2 hasn't occurred at least.

Though error 32 is reported, as soon as Nicotine+ runs, I see config and config.old's modified timestamp updating. On the surface, it doesn't seem like anything is particularly wrong, other than an error message appearing. I'm not seeing any failed cloud sync uploads either.

@redactedscribe
Copy link
Contributor Author

redactedscribe commented Jan 16, 2021

Seems I spoke too early. For the first time in say 15 launches, WinError 2 occurred, and only because both the sync app and Nicotine+ were accessing it at the same time again.

@mathiascode
Copy link
Member

I changed the behavior to copy the "config" file to "config.old", instead of moving it and creating a new "config" file. Can you try this build? https://github.com/mathiascode/nicotine-plus/actions/runs/491468869

@redactedscribe
Copy link
Contributor Author

redactedscribe commented Jan 17, 2021

If I understand correctly, Nicotine+ was using atomic saving prior to this change. I have launched this build several times and I haven't seen the error once. It should be better using a copy now, at least for Windows. It's not easy to reproduce the error since the cloud syncing isn't predictable. Now that I haven't seen the error with this build, I'd say it's fixed. If I notice it again, I'll report it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants