Sorry. Let me describe the problem in more detail.
The process only hangs when launched without root privileges on the host (Arch Linux x64 with kernel 4.17.5-1) where Alpine docker container is running. Once with root privileges, it starts up correctly (but this is obvious since it doesn't hit setrlimit call). The odd side is that on other hosts it hangs even when started with root. No error messages so far. Strace output:
$ sudo strace -p 9285
futex(0x2cddfc0, FUTEX_WAIT_PRIVATE, 0, NULL
$ sudo strace -f -p 9285
.....
[pid 9287] getdents64(10, /* 14 entries */, 2048) = 336
[pid 9287] tgkill(9285, 9285, SIGRT_2) = 0
[pid 9287] futex(0x7efbff70008c, FUTEX_LOCK_PI_PRIVATE, {tv_sec=1537887068, tv_nsec=51442144}) = -1 ETIMEDOUT (Connection timed out)
[pid 9287] getdents64(10, /* 0 entries */, 2048) = 0
[pid 9287] lseek(10, 0, SEEK_SET) = 0
[pid 9287] getdents64(10, /* 14 entries */, 2048) = 336
[pid 9287] tgkill(9285, 9285, SIGRT_2) = 0
[pid 9287] futex(0x7efbff70008c, FUTEX_LOCK_PI_PRIVATE, {tv_sec=1537887068, tv_nsec=62384239}) = -1 ETIMEDOUT (Connection timed out)
[pid 9287] getdents64(10, /* 0 entries */, 2048) = 0
[pid 9287] lseek(10, 0, SEEK_SET) = 0
[pid 9287] getdents64(10, /* 14 entries */, 2048) = 336
[pid 9287] tgkill(9285, 9285, SIGRT_2) = 0
[pid 9287] futex(0x7efbff70008c, FUTEX_LOCK_PI_PRIVATE, {tv_sec=1537887068, tv_nsec=73251219}) = -1 ETIMEDOUT (Connection timed out)
[pid 9287] getdents64(10, /* 0 entries */, 2048) = 0
[pid 9287] lseek(10, 0, SEEK_SET) = 0
[pid 9287] getdents64(10, /* 14 entries */, 2048) = 336
[pid 9287] tgkill(9285, 9285, SIGRT_2) = 0
[pid 9287] futex(0x7efbff70008c, FUTEX_LOCK_PI_PRIVATE, {tv_sec=1537887068, tv_nsec=84458579}) = -1 ETIMEDOUT (Connection timed out)
[pid 9287] getdents64(10, /* 0 entries */, 2048) = 0
[pid 9287] lseek(10, 0, SEEK_SET) = 0
[pid 9287] getdents64(10, /* 14 entries */, 2048) = 336
[pid 9287] tgkill(9285, 9285, SIGRT_2) = 0
[pid 9287] futex(0x7efbff70008c, FUTEX_LOCK_PI_PRIVATE, {tv_sec=1537887068, tv_nsec=95098614}) = -1 ETIMEDOUT (Connection timed out)
[pid 9287] getdents64(10, /* 0 entries */, 2048) = 0
[pid 9287] lseek(10, 0, SEEK_SET) = 0
[pid 9287] getdents64(10, /* 14 entries */, 2048) = 336
[pid 9287] tgkill(9285, 9285, SIGRT_2) = 0
[pid 9287] futex(0x7efbff70008c, FUTEX_LOCK_PI_PRIVATE, {tv_sec=1537887068, tv_nsec=106005502}) = -1 ETIMEDOUT (Connection timed out)
[pid 9287] getdents64(10, /* 0 entries */, 2048) = 0
[pid 9287] lseek(10, 0, SEEK_SET) = 0
[pid 9287] getdents64(10, /* 14 entries */, 2048) = 336
[pid 9287] tgkill(9285, 9285, SIGRT_2) = 0
.....
I'll try to build a tiny example to isolate the problem and hopefully provide more feedback.
Thanks