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

Windows: rename(C:\misc/GeoIPCity.dat.new,C:\misc/GeoIPCity.dat): The process cannot access the file because it is being used by another process. (code: 32) #5050

Closed
mattab opened this issue Apr 28, 2014 · 8 comments · Fixed by #11908
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@mattab
Copy link
Member

mattab commented Apr 28, 2014

Bug reported in the forum:

 Warning:</strong> <em>rename(C:\Webservices\htdocs\piwik/misc/GeoIPCity.dat.new,C:\Webservices\htdocs\piwik/misc/GeoIPCity.dat): The process cannot access the file because it is being used by another process. (code: 32)</em> in <strong>C:\Webservices\htdocs\piwik\plugins\UserCountry\GeoIPAutoUpdater.php</strong> on line <strong>268</strong>

This is triggered in the cron, Scheduled tasks.

I'm not sure what should be done with this issue?

@mattab mattab added this to the 2.x - The Great Piwik 2.x Backlog milestone Jul 8, 2014
@mattab mattab modified the milestones: Mid term, Short term Oct 11, 2014
@mattab mattab added Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change. and removed Bug For errors / faults / flaws / inconsistencies etc. labels Dec 1, 2014
@mattab mattab modified the milestones: Mid term, Short term Dec 1, 2014
@grzchr15
Copy link

This does still not work with Piwik 2.16.0 . So the autodownloader of GeoIP DBs is still senseless
Only manual updating works
Renaming cannot work, but 2 files which are used alternative may work

@MHimken
Copy link

MHimken commented Oct 9, 2016

Hi all, so I've encountered this error as well. For now I've changed the GeoIPAutoUpdater.php, line 271 to copy instead of rename - ofc this will leave the .new file in the folder. It will be overwritten in the next scheduled update though. It's still better than not being able to autodownload those files. Unfortunately there seems to be no way to "close" the GeoIP Database before deleting/renaming. I have no idea what's keeping that file open reading the code.

@Globulopolis
Copy link
Contributor

Yes, this is a bug on Windows platform. In some situations rename function cannot work. In my other project i do copy instead of rename.

@mattab mattab modified the milestones: Long term, Mid term Dec 5, 2016
@huan086
Copy link

huan086 commented Apr 7, 2017

Still broken in Piwik 3.0.3. @sanso2010's workaround #5050 (comment) still works.

@mattab
Copy link
Member Author

mattab commented Jun 21, 2017

Thanks for letting us know, we'll take a look at this

@mattab mattab added Bug For errors / faults / flaws / inconsistencies etc. and removed Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change. labels Jun 21, 2017
@mattab mattab modified the milestones: 3.0.5, Backlog (Help wanted) Jun 21, 2017
@mattab mattab modified the milestones: 3.0.5, 3.1.0 Jul 12, 2017
@mattab mattab modified the milestones: 3.1.0, 3.0.5 Jul 12, 2017
@mstenz
Copy link

mstenz commented Aug 1, 2017

I am wondering why this easy change is not yet done as a fix is already provided
I cant do it because i am not used to git so much, but for someone dealing anyhow with the piwik code it took 5 seconds to fix this.

@mattab
Copy link
Member Author

mattab commented Aug 1, 2017

@mstenz Would you please share a patch (even if not a pull request) that you have tested and fixes the issue for sure?

@mstenz
Copy link

mstenz commented Aug 1, 2017

I don't know how to do this, but you just need to replace one word on line 271 in plugins\UserCountry\Ge
oIPAutoUpdater.php
rename($tempFile, $oldDbFile);
to
copy($tempFile, $oldDbFile);
Solution was provided already by other users in this thread.

RMastop added a commit to RMastop/piwik that referenced this issue Aug 1, 2017
mattab pushed a commit that referenced this issue Sep 18, 2017
* copy file instead of renaming it.

As stated in thread; fixes #5050

* Update GeoIPAutoUpdater.php

In most cases the rename is successful, in rare cases the rename cannot be completed. In those cases we do a copy, leaving the $tempFile in place, it will be overwritten during the next  GeoIPAutopudater task.

Tested in both windows and Ubuntu environment.

* Add unlink
@mattab mattab modified the milestones: 3.2.0, 3.1.1 Sep 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants