|
|
Message-ID: <20180925151336.GK17995@brightrain.aerifal.cx>
Date: Tue, 25 Sep 2018 11:13:36 -0400
From: Rich Felker <dalias@...c.org>
To: Rabbitstack <rabbitstack7@...il.com>
Cc: musl@...ts.openwall.com
Subject: Re: setrlimit hangs the process
On Tue, Sep 25, 2018 at 04:54:37PM +0200, Rabbitstack wrote:
> 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.
The trace here shows a thread, tid 9285, the main thread, not
responding to the broadcast signals that are necessary to stop all
threads for the purpose of changing resource limits, uids/gids/etc.
I'm guessing some part of the Go runtime has bypassed libc and blocked
libc-internal signals in the main thread. A full strace rather than a
truncated one like the above would show this happening. If you can
produce one that doesn't expose private data that would be helpful; if
not, perhaps it's possible to write a minimal Go program that
reproduces the issue and strace it instead.
Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.