Page MenuHomePhabricator

Problem with two running instances
Closed, DuplicatePublic

Description

Sometimes when running two instances of interwiki bot I got in one window this (multiple) message.
Usualy when one instance is waiting for response from server, but not always:

NOTE: [[ml:plnohodnotný]] does not exist. Skipping.
Traceback (most recent call last):
  File "C:\Python27\lib\logging\handlers.py", line 77, in emit
    self.doRollover()
  File "I:\py\rewrite\pywikibot\bot.py", line 90, in doRollover
    os.rename(self.baseFilename, dfn)
WindowsError: [Error 32] Proces nemß p°Ýstup k souboru, neboŁ jej prßvý vyu×Ývß jinř proces
Logged from file bot.py, line 388

Translate of error: The process can not access the file because it is being used by another process
There is also strange charset in this message (probably from windows-side)

Event Timeline

JAnD raised the priority of this task from to Low.
JAnD updated the task description. (Show Details)
JAnD added a project: Pywikibot.
JAnD subscribed.

That is happening because both instances use the same log file, but to use that log file it needs to move the old log files and this includes the currently used log file by the first instance. I'm not sure how to solve that problem though.

Maybe we should use the PID from throttle to create the file name

If we can check whether the file is open by another process, we could use the simple name (no pid) by default, and then fallback to using a pid in the filename if necessary.

Also a compat bug T56685 ; and core bug T93357 looks similar.