Skip to content

Infinite loop if core pinning fails #103

@IagoAbal

Description

@IagoAbal

Core pinning does not always work on Apple M1 and as a result Parmap enters an infinite loop. See semgrep/semgrep#2432 and facebook/infer#1410. We at @returntocorp have only observed this behavior with HomeBrew builds, presumably because in HomeBrew's build environment HAVE_MACH_THREAD_POLICY_H is set? Even then, this only occurs under certain values of ncores and chunksize. So running on 8 files using 8 cores and chunk size of 1 works, but if there are 9 files it hangs. Running on 9 files with 4 cores and a chunk size of 2 it does not hang.

Our current work around is to simply disable core pinning.

Independently of why core pinning is failing in this case, could it make sense to change while (finished==0) { ... } to do { ... } while (finished==0 && w>0) or bound the number of iterations of that loop in some other way ? I am happy to open a PR if we agree on this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions