-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression: File descriptor / Assertion error when using curl via nvchecker #15725
Comments
It seems like it crashes here: https://github.com/systemd/systemd/blob/b83847eb1321ee79e1ab073b79e3001320b839a4/src/basic/fd-util.c#L59-L79 Also the previous systemd version (256.9-1) exhibits the same issue. |
9212483 enabled a pre-existing codebase that was left disabled (due to typo) since its inception (in 8.9.0). It'd probably be more useful to fix the bug, or if this is not possible, drop this edit: workaround for CMake: |
I have disable support for eventfd for now: https://gitlab.archlinux.org/archlinux/packaging/packages/curl/-/commit/1963701abfc6e9f20db4052c629fc842413828b2 But of course the root cause for this should be fixed... |
I'm guessing the issue is that If nss-resolve opens its varlink socket between these two calls to Otherwise, curl gets an |
I think the bug probably involves the |
@panjf2000 Would you mind taking a look? |
Sure, I'll handle it. |
Thinking about it, it should be possible to duplicate the file descriptor to get the same behavior with two FDs you can close separately. However, I don't think there's a variant of dup that duplicates the FD to an unassigned number and atomically sets CLOEXEC. (And avoiding unnecessarily allocating file descriptors is probably prudent.) |
I don't think we need to dupe it. Can't we just add an #ifdef for the eventfd situation and avoid closing one of them then? |
When employing eventfd for socketpair, there is only one file descriptor. Closing that fd twice might result in fd corruption. Thus, we should avoid closing the eventfd twice, following the pattern in lib/multi.c. Fixes curl#15725
Hi @christian-heusel, could you compile and run this patch #15727 on your machine to see if it fixes the issue? Thanks! |
This seems to fix the crash, thanks for coming up with a fix so quickly 🤗 |
I did this
I have a few local configs for lilydjwg/nvchecker which I regularily run via systemd-timers and the following commandline invocation:
Since today this gives me the following errors every few runs (although the assert is more prominently faced):
I have also seen the error with the
pacman
package manager once so far.I then looked into the issue in a bit more detail and found that bisecting the issue between 8.11.0 and 8.11.1 lead me to
92124838c
("socketpair: fix enablingUSE_EVENTFD
") as a culprit which in turn fixes enabling of the functionality in23fe1a52d
("socketpair: addeventfd
and useSOCK_NONBLOCK
forsocketpair()
"). Reverting 9212483 on top of reliably fixes the issue on my machine.I also found that the issue does not reproduce every time and seems to be more prevalent when I clear my DNS cache via
resolvectl flush-caches
.The backtrace for the crash is the following:
If you think this is a bug in systemd rather than curl please tell me, so far it looked plausible that it's an issue with the curl codebase. Also if you have any idea about a minimal reproducer I'm happy to test things.
I expected the following
I expected these command to just continue working as usual.
curl/libcurl version
operating system
Arch Linux (rolling)
uname -a
:systemd version:
257-1
The text was updated successfully, but these errors were encountered: