Skip to content

Conversation

@bnoordhuis
Copy link
Member

Work around a poorly understood bug in older kernels where closing a file descriptor pointing to /foo/bar results in ETXTBSY errors when trying to execve("/foo/bar") later on.

The bug seems to have been fixed somewhere between 5.15.78 and 5.15.98. I couldn't pinpoint the responsible commit but good candidates are the several data race fixes.

Interestingly, it seems to manifest only when running under Docker so the possibility of Docker bug can't be completely ruled out either.

This commit moves uv__kernel_version() from fs.c to linux.c because the latter now uses it more than the former.

Fixes: nodejs/node#48444

Copy link

@ronag ronag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this cause other bugs? i.e. is it safe to just skip OP_CLOSE?

@bnoordhuis
Copy link
Member Author

Libuv falls back to the thread pool. The file descriptor is still closed, just not by io_uring.

Copy link
Member

@santigimeno santigimeno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My worry is that this might manifest in other scenarios as the commits in those kernel versions don't explicitly point to an IORING_OP_CLOSE issue

@santigimeno
Copy link
Member

Maybe @axboe can help us understand what's happening here.

@ronag
Copy link

ronag commented Jun 20, 2023

maybe just totally disable ioring for older kernel versions?

@bnoordhuis
Copy link
Member Author

That's a little heavy-handed, no?

Work around a poorly understood bug in older kernels where closing a file descriptor pointing to /foo/bar results in ETXTBSY errors when trying to execve("/foo/bar") later on. The bug seems to have been fixed somewhere between 5.15.85 and 5.15.90. I couldn't pinpoint the responsible commit but good candidates are the several data race fixes. Interestingly, it seems to manifest only when running under Docker so the possibility of a Docker bug can't be completely ruled out either. This commit moves uv__kernel_version() from fs.c to linux.c because the latter now uses it more than the former. Fixes: nodejs/node#48444
@bnoordhuis bnoordhuis merged commit 1752791 into libuv:v1.x Jun 20, 2023
@bnoordhuis bnoordhuis deleted the fix48444 branch June 20, 2023 11:01
@ronag
Copy link

ronag commented Jun 20, 2023

That's a little heavy-handed, no?

It feels a little experimental if there are issues and we don't know precisely what they are and whether it also affects other calls...

@bnoordhuis
Copy link
Member Author

Everything has issues, not just io_uring.

A big part of libuv is detecting and working around missing or broken operating system features, just take a look a src/unix/fs.c.

bnoordhuis added a commit to bnoordhuis/libuv that referenced this pull request Jun 20, 2023
Work around a poorly understood bug in older kernels where closing a file descriptor pointing to /foo/bar results in ETXTBSY errors when trying to execve("/foo/bar") later on. The bug seems to have been fixed somewhere between 5.15.85 and 5.15.90. I couldn't pinpoint the responsible commit but good candidates are the several data race fixes. Interestingly, it seems to manifest only when running under Docker so the possibility of a Docker bug can't be completely ruled out either. This commit moves uv__kernel_version() from fs.c to linux.c because the latter now uses it more than the former. Fixes: nodejs/node#48444
santigimeno added a commit to santigimeno/node that referenced this pull request Jun 30, 2023
Notable changes - fs: use WTF-8 on Windows: libuv/libuv#2970 - linux: add some more iouring backed fs ops: libuv/libuv#4012 Important bugs fixed - linux: work around io_uring IORING_OP_CLOSE bug: libuv/libuv#4059 - src: don't run timers if loop is stopped/unref'd: libuv/libuv#4048
nodejs-github-bot pushed a commit to nodejs/node that referenced this pull request Jul 2, 2023
Notable changes - fs: use WTF-8 on Windows: libuv/libuv#2970 - linux: add some more iouring backed fs ops: libuv/libuv#4012 Important bugs fixed - linux: work around io_uring IORING_OP_CLOSE bug: libuv/libuv#4059 - src: don't run timers if loop is stopped/unref'd: libuv/libuv#4048 PR-URL: #48618 Fixes: #48512 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
RafaelGSS pushed a commit to nodejs/node that referenced this pull request Jul 3, 2023
Notable changes - fs: use WTF-8 on Windows: libuv/libuv#2970 - linux: add some more iouring backed fs ops: libuv/libuv#4012 Important bugs fixed - linux: work around io_uring IORING_OP_CLOSE bug: libuv/libuv#4059 - src: don't run timers if loop is stopped/unref'd: libuv/libuv#4048 PR-URL: #48618 Fixes: #48512 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Aug 14, 2023
Notable changes - fs: use WTF-8 on Windows: libuv/libuv#2970 - linux: add some more iouring backed fs ops: libuv/libuv#4012 Important bugs fixed - linux: work around io_uring IORING_OP_CLOSE bug: libuv/libuv#4059 - src: don't run timers if loop is stopped/unref'd: libuv/libuv#4048 PR-URL: nodejs#48618 Fixes: nodejs#48512 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Aug 14, 2023
Notable changes - fs: use WTF-8 on Windows: libuv/libuv#2970 - linux: add some more iouring backed fs ops: libuv/libuv#4012 Important bugs fixed - linux: work around io_uring IORING_OP_CLOSE bug: libuv/libuv#4059 - src: don't run timers if loop is stopped/unref'd: libuv/libuv#4048 PR-URL: nodejs#48618 Fixes: nodejs#48512 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
arsnyder16 pushed a commit to arsnyder16/node that referenced this pull request Sep 10, 2023
Notable changes - fs: use WTF-8 on Windows: libuv/libuv#2970 - linux: add some more iouring backed fs ops: libuv/libuv#4012 Important bugs fixed - linux: work around io_uring IORING_OP_CLOSE bug: libuv/libuv#4059 - src: don't run timers if loop is stopped/unref'd: libuv/libuv#4048 PR-URL: nodejs#48618 Fixes: nodejs#48512 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
ruyadorno pushed a commit to nodejs/node that referenced this pull request Sep 11, 2023
Notable changes - fs: use WTF-8 on Windows: libuv/libuv#2970 - linux: add some more iouring backed fs ops: libuv/libuv#4012 Important bugs fixed - linux: work around io_uring IORING_OP_CLOSE bug: libuv/libuv#4059 - src: don't run timers if loop is stopped/unref'd: libuv/libuv#4048 PR-URL: #48618 Backport-PR-URL: #49591 Fixes: #48512 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> PR-URL: #48078
ruyadorno pushed a commit to nodejs/node that referenced this pull request Sep 13, 2023
Notable changes - fs: use WTF-8 on Windows: libuv/libuv#2970 - linux: add some more iouring backed fs ops: libuv/libuv#4012 Important bugs fixed - linux: work around io_uring IORING_OP_CLOSE bug: libuv/libuv#4059 - src: don't run timers if loop is stopped/unref'd: libuv/libuv#4048 PR-URL: #48618 Backport-PR-URL: #49591 Fixes: #48512 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> PR-URL: #48078
ruyadorno pushed a commit to nodejs/node that referenced this pull request Sep 17, 2023
Notable changes - fs: use WTF-8 on Windows: libuv/libuv#2970 - linux: add some more iouring backed fs ops: libuv/libuv#4012 Important bugs fixed - linux: work around io_uring IORING_OP_CLOSE bug: libuv/libuv#4059 - src: don't run timers if loop is stopped/unref'd: libuv/libuv#4048 PR-URL: #48618 Backport-PR-URL: #49591 Fixes: #48512 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> PR-URL: #48078
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants