Skip to content

32bit arch must set /proc/sys/kernel/pid_max = 65535 #40

@truboxl

Description

@truboxl

https://android.googlesource.com/platform/bionic/#host-tests
https://android.googlesource.com/platform/bionic/+/master/libc/bionic/libc_init_common.cpp

When running certain multi threaded program in 32bit containers, the PIDs can balloon and easily exceed libc's limit.
The following error will be shown:

Limited by the size of pthread_mutex_t, 32 bit bionic libc only accepts pid <= 65535, but current pid is 65969
libc: Limited by the size of pthread_mutex_t, 32 bit bionic libc only accepts pid <= 65535, but current pid is 65969
libc: Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 65969 (emcc), pid 65969 (emcc)

This was spotted when running emscripten tests in i686 container on x86_64 host
which the pid_max value of both host and container is

$ cat /proc/sys/kernel/pid_max 
4194304

The only way to fix this is to set /proc/sys/kernel/pid_max to 65535 but setting this will affect both container and host globally at runtime. I think we can list this as a caveat.

EDIT: updated to 65535 in 6189bbd. Sorry for the confusion future readers.

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