Skip to content

Collision in multi-process mode #191

Closed

Description

@aimestereo

Hello @brian-brazil.

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.


PR: #192

Activity

  1. brian-brazil commented on Aug 30, 2017

    @brian-brazil
    Contributor

    Are you sure you're using the latest release of the client? This should all work correctly already.

  2. aimestereo commented on Aug 30, 2017

    @aimestereo
    ContributorAuthor

    yes, we noticed corrupted metric files before 0.0.20, switch to the newest version and it didn't help.

  3. aimestereo commented on Aug 30, 2017

    @aimestereo
    ContributorAuthor

    please inform me, if you have in mind other ways to fix this issue.

  4. brian-brazil commented on Aug 31, 2017

    @brian-brazil
    Contributor

    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.

  5. megabuz commented on Aug 31, 2017

    @megabuz

    @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

  6. brian-brazil commented on Sep 1, 2017

    @brian-brazil
    Contributor

    I see what you're saying now.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions