Skip to content
This repository has been archived by the owner on Mar 8, 2020. It is now read-only.

bblfsh.decode hangs with multiprocessing #171

Open
vmarkovtsev opened this issue Jul 20, 2019 · 1 comment
Open

bblfsh.decode hangs with multiprocessing #171

vmarkovtsev opened this issue Jul 20, 2019 · 1 comment
Labels

Comments

@vmarkovtsev
Copy link
Contributor

The following code hangs:

import bblfsh

def decode(uast):
    return bblfsh.decode(uast).load()

uasts = [b"", b"", ...]  # protobuf bytes
pool = multiprocessing.Pool(multiprocessing.cpu_count())
pool.map(decode, uasts)

however this doesn't

def decode(uast):
    import bblfsh
    return bblfsh.decode(uast).load()

uasts = [b"", b"", ...]  # protobuf bytes
pool = multiprocessing.Pool(multiprocessing.cpu_count())
pool.map(decode, uasts)

The reason is likely because gRPC in Python infinitely sucks as always, and it manages to interfere with regular protobuf reading somehow. I wonder if there is a way to fix this.

We had to defer grpc loading in the past when we had similar problems.

@creachadair
Copy link
Contributor

I think grpc/grpc#16001 is likely to be relevant here. Specifically, this might explain why the deferred import appears to "help" in this case.

@bzz bzz added the bug label Jul 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants