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

Billiard is leaving pipes open #329

Open
luederm opened this issue Jan 26, 2021 · 4 comments
Open

Billiard is leaving pipes open #329

luederm opened this issue Jan 26, 2021 · 4 comments

Comments

@luederm
Copy link

luederm commented Jan 26, 2021

I am using Celery to initiate long running pipelines and I override multiprocessing imports with Biliard. I notice as a pipeline runs, the number of open files (pipes) steadly increases and never decreases. This occurs until tens of thousands of pipes are opened and I get the error OSError: [Errno 24] Too many open files.
I ran this pipeline outside of Celery without overriding multiprocessing imports and this issue does not occur. Processes are spawned by Luigi workers and I am using the latest version of Celery.

@auvipy
Copy link
Member

auvipy commented Jan 27, 2021

were you able to figure out the root of this in billiard?

@luederm
Copy link
Author

luederm commented Jan 27, 2021

I use the following code to override multiprocessing imports in a 3rd party package (luigi) with biliard:

def _import(name, *args, **kwargs):
    if name == 'multiprocessing':
        name = 'billiard'
    return original_import(name, *args, **kwargs)

original_import = builtins.__import__
builtins.__import__ = _import

I performed 2 tests by running my luigi pipeline manually, outside of Celery.
In test A, I ran my pipeline without the above code (so luigi uses multiprocessing). In this test the number of open pipes as described by the lsof commnd remained stable and the pipeline completed successfully.
I test B, I ran the pipeline with the above code (so luigi uses billiard). This causes the number of open pipes to continually increase until the program crashes.

All code referencing billiard/multiprocessing is in luigi (version 3.0.2). I did not write multiprocessing code of my own.

Edit: I originally misread you question, but will leave this here incase the information is useful. I did not figure out what code in billiard was causing the issue.

@darkl1ght
Copy link

darkl1ght commented Feb 10, 2021

I am using Celery to initiate long running pipelines and I override multiprocessing imports with Biliard. I notice as a pipeline runs, the number of open files (pipes) steadly increases and never decreases. This occurs until tens of thousands of pipes are opened and I get the error OSError: [Errno 24] Too many open files.
I ran this pipeline outside of Celery without overriding multiprocessing imports and this issue does not occur. Processes are spawned by Luigi workers and I am using the latest version of Celery.

How do you override multiprocessing imports with Billiard?
I am new to billiard and trying to figure out where to begin with.
I am also stuck with this question: https://stackoverflow.com/questions/66135819/running-subprocess-popen-in-celery-task-gives-status-code-134sigabrt-error?noredirect=1#comment116933899_66135819

Please see, if you could help me in any way or direction with my question.

@luederm
Copy link
Author

luederm commented Feb 10, 2021

@darkl1ght That is what is shown in the code in my comment above. That code needs to run before you import multiprocessing.

WRT you stackoverflow question (I don't have enough rep to comment), I doubt that is a Celery issue. To my knowledge, billiards does not affect subprocess calls. Does the subprocess command fail when not using celery?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants