You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In our project we use celery. And we experience a bug when all workers write to one file created by the master process. It's happening because metrics are initialized before fork and an open file is inherited by the child process. _MmapedValue in the child is created correctly, with new pid, so the child doesn't know that files belong to another process.
Looking at the code I don't see how this is happening. If there's a fork then the pid will change, the files will be closed in the child and new files opened.
@brian-brazil
let's say we have two summary metrics
metric1 initialized in master and we have nonlocal files = {'summary': ...} initialized after that
metric2 initialized only in child. __reset called from __init__ and set self._pid in instance as child pid __reset function see files = {'summary': ...} from master and use master filepath
condition in __check_for_pid_change for metric2 will not pass because self._pid is already child pid there
Activity
brian-brazil commentedon Aug 30, 2017
Are you sure you're using the latest release of the client? This should all work correctly already.
aimestereo commentedon Aug 30, 2017
yes, we noticed corrupted metric files before
0.0.20, switch to the newest version and it didn't help.aimestereo commentedon Aug 30, 2017
please inform me, if you have in mind other ways to fix this issue.
brian-brazil commentedon Aug 31, 2017
Looking at the code I don't see how this is happening. If there's a fork then the pid will change, the files will be closed in the child and new files opened.
megabuz commentedon Aug 31, 2017
@brian-brazil
let's say we have two summary metrics
metric1 initialized in master and we have nonlocal
files = {'summary': ...}initialized after thatmetric2 initialized only in child.
__resetcalled from__init__and setself._pidin instance as child pid__resetfunction seefiles = {'summary': ...}from master and use master filepathcondition in
__check_for_pid_changefor metric2 will not pass becauseself._pidis already child pid therebrian-brazil commentedon Sep 1, 2017
I see what you're saying now.