io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* io_uring_setup spuriously returning ENOMEM for one user
@ 2020-07-16 20:05 Andres Freund
  2020-07-16 20:12 ` Pavel Begunkov
  0 siblings, 1 reply; 4+ messages in thread
From: Andres Freund @ 2020-07-16 20:05 UTC (permalink / raw)
  To: Jens Axboe, io-uring

Hi,

While testing the error handling of my uring using postgres branch I
just encountered the situation that io_uring_setup() always fails with
ENOMEN.

It only does so for the user I did the testing on and not for other
users. During the testing a few io_uring using processes were kill -9'd
and a few core-dumped after abort(). No io_uring using processes are
still alive.

As the issue only happens to the one uid I suspect that
current_user()->locked_mem got corrupted, perhaps after hitting the
limit for real.

Unfortunately I do not see any way to debug this without restarting. It
seems the user wide limit isn't exported anywhere? I found
uids_sysfs_init() while grepping around, but it seems that's just a
leftover.

This happened on 07a56bb875afbe39dabbf6ba7b83783d166863db / 5.8rc5 +
16. I left the machine running for now, in case there's something that
can be debugged while running. But I've to restart it in a bit. It took
a while to hit this issue, unfortunately.

Greetings,

Andres Freund

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: io_uring_setup spuriously returning ENOMEM for one user
  2020-07-16 20:05 io_uring_setup spuriously returning ENOMEM for one user Andres Freund
@ 2020-07-16 20:12 ` Pavel Begunkov
  2020-07-16 20:20   ` Andres Freund
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Begunkov @ 2020-07-16 20:12 UTC (permalink / raw)
  To: Andres Freund, Jens Axboe, io-uring

On 16/07/2020 23:05, Andres Freund wrote:
> Hi,
> 
> While testing the error handling of my uring using postgres branch I
> just encountered the situation that io_uring_setup() always fails with
> ENOMEN.
> 
> It only does so for the user I did the testing on and not for other
> users. During the testing a few io_uring using processes were kill -9'd
> and a few core-dumped after abort(). No io_uring using processes are
> still alive.
> 
> As the issue only happens to the one uid I suspect that
> current_user()->locked_mem got corrupted, perhaps after hitting the
> limit for real.

Any chance it's using SQPOLL mode?

> 
> Unfortunately I do not see any way to debug this without restarting. It
> seems the user wide limit isn't exported anywhere? I found
> uids_sysfs_init() while grepping around, but it seems that's just a
> leftover.
> 
> This happened on 07a56bb875afbe39dabbf6ba7b83783d166863db / 5.8rc5 +
> 16. I left the machine running for now, in case there's something that
> can be debugged while running. But I've to restart it in a bit. It took
> a while to hit this issue, unfortunately.
> 

-- 
Pavel Begunkov

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: io_uring_setup spuriously returning ENOMEM for one user
  2020-07-16 20:12 ` Pavel Begunkov
@ 2020-07-16 20:20   ` Andres Freund
  2020-07-16 20:31     ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Andres Freund @ 2020-07-16 20:20 UTC (permalink / raw)
  To: Pavel Begunkov; +Cc: Jens Axboe, io-uring

Hi,

On 2020-07-16 23:12:41 +0300, Pavel Begunkov wrote:
> On 16/07/2020 23:05, Andres Freund wrote:
> > Hi,
> > 
> > While testing the error handling of my uring using postgres branch I
> > just encountered the situation that io_uring_setup() always fails with
> > ENOMEN.
> > 
> > It only does so for the user I did the testing on and not for other
> > users. During the testing a few io_uring using processes were kill -9'd
> > and a few core-dumped after abort(). No io_uring using processes are
> > still alive.
> > 
> > As the issue only happens to the one uid I suspect that
> > current_user()->locked_mem got corrupted, perhaps after hitting the
> > limit for real.
> 
> Any chance it's using SQPOLL mode?

No. It's a "plain" uring. The only thing that could be considered
special is that one of the rings is shared between processes (which all
run as the same user).

Greetings,

Andres Freund

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: io_uring_setup spuriously returning ENOMEM for one user
  2020-07-16 20:20   ` Andres Freund
@ 2020-07-16 20:31     ` Jens Axboe
  0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2020-07-16 20:31 UTC (permalink / raw)
  To: Andres Freund, Pavel Begunkov; +Cc: io-uring

On 7/16/20 2:20 PM, Andres Freund wrote:
> Hi,
> 
> On 2020-07-16 23:12:41 +0300, Pavel Begunkov wrote:
>> On 16/07/2020 23:05, Andres Freund wrote:
>>> Hi,
>>>
>>> While testing the error handling of my uring using postgres branch I
>>> just encountered the situation that io_uring_setup() always fails with
>>> ENOMEN.
>>>
>>> It only does so for the user I did the testing on and not for other
>>> users. During the testing a few io_uring using processes were kill -9'd
>>> and a few core-dumped after abort(). No io_uring using processes are
>>> still alive.
>>>
>>> As the issue only happens to the one uid I suspect that
>>> current_user()->locked_mem got corrupted, perhaps after hitting the
>>> limit for real.
>>
>> Any chance it's using SQPOLL mode?
> 
> No. It's a "plain" uring. The only thing that could be considered
> special is that one of the rings is shared between processes (which all
> run as the same user).

Do you have this one:

ommit 309fc03a3284af62eb6082fb60327045a1dabf57 (tag: io_uring-5.8-2020-07-10)
Author: Jens Axboe <axboe@kernel.dk>
Date:   Fri Jul 10 09:13:34 2020 -0600

    io_uring: account user memory freed when exit has been queued

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-07-16 20:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16 20:05 io_uring_setup spuriously returning ENOMEM for one user Andres Freund
2020-07-16 20:12 ` Pavel Begunkov
2020-07-16 20:20   ` Andres Freund
2020-07-16 20:31     ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).