Skip to content

gen_cluster nanny tests intermittently fail on Python 2 #1491

Closed

Description

@mrocklin

This fails in Python 2, but not Python 3:

from distributed import Nanny
from distributed.utils_test import gen_cluster
@gen_cluster(client=True, Worker=Nanny)
def test_startup(c, s, a, b):
    pass
for i in range(100):
    test_startup()

Activity

  1. mrocklin commented on Oct 20, 2017

    @mrocklin
    MemberAuthor

    Git bisect traces this back to 647238e cc @pitrou . I don't yet know how critical this is though. We have lived with this for a long time.

  2. mrocklin commented on Oct 21, 2017

    @mrocklin
    MemberAuthor

    I tracked this down to logging code within the worker. Just calling logger.info("Hello") when starting up is enough to sometimes lock down the worker process. Perhaps forking after starting the logger does something unpleasant?

  3. mrocklin commented on Oct 21, 2017

    @mrocklin
    MemberAuthor

    From celery/celery#496 which maybe discusses the same problem:

    python logging, uses RLock() locks, and those are broken after a fork.
    Looking the long history of this python bug, the conclusion that this bug is not going to be solved in python.

  4. mrocklin commented on Oct 21, 2017

    @mrocklin
    MemberAuthor

    OK, it looks like they resolved it by recreating the lock at the onset of every new process. This seems to resolve things for me as well.

  5. added a commit that references this issue on Oct 21, 2017
  6. added a commit that references this issue on Oct 21, 2017
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