eventfd / poll interaction bug

Bug #1761619 reported by Garrett D'Amore
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Expired
Medium
Unassigned

Bug Description

In 17.10, I'm running into a new problem. This didn't happen to me on 16.04.

I have some code that uses eventfds to signal things, and the code is not working -- after writing the eventfd, it does not come back readable from another thread using poll().

Here's a snippet from strace:

```
eventfd2(0, 0) = 5
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
write(1, "OPEN FD 5\n", 10OPEN FD 5
) = 10
write(5, "\1\0\0\0\0\0\0\0", 8) = 8
nanosleep({tv_sec=0, tv_nsec=100000000}, 0x7fffd0cea1a0) = 0
poll([{fd=5, events=POLLRDNORM}], 1, 100) = 0 (Timeout)
```

The write(1,... ) is debugging output. The nanosleep was intended to see if sleeping a bit before polling would help. Note that the write(5, ...) and the poll() come from different threads.

Note that using two descriptors from a pipe() (which I do for other platforms) is fine, so this is some kind of issue specific to eventfd.

Also, trying to reproduce this with a simpler single threaded program did not succeed. I'm wondering if there is some underlying cache synchronization problem?

I'm testing this in a VMware Fusion virtual machine (Fusion 10.1.1) running on 2017 macbook pro (underlying OS is macOS 10.13).

For now I'm going to switch back to pipes, since eventfd() seems unreliable -- if you can spot anything obviously wrong about the system call sequence above, I'd love to hear it.

Revision history for this message
Ubuntu Kernel Bot (ubuntu-kernel-bot) wrote : Missing required logs.

This bug is missing log files that will aid in diagnosing the problem. While running an Ubuntu kernel (not a mainline or third-party kernel) please enter the following command in a terminal window:

apport-collect 1761619

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: New → Incomplete
Revision history for this message
Joseph Salisbury (jsalisbury) wrote :

Would it be possible for you to test the latest upstream kernel? Refer to https://wiki.ubuntu.com/KernelMainlineBuilds . Please test the latest v4.16 kernel[0].

If this bug is fixed in the mainline kernel, please add the following tag 'kernel-fixed-upstream'.

If the mainline kernel does not fix this bug, please add the tag: 'kernel-bug-exists-upstream'.

Once testing of the upstream kernel is complete, please mark this bug as "Confirmed".

Thanks in advance.

[0] http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.16

Changed in linux (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for linux (Ubuntu) because there has been no activity for 60 days.]

Changed in linux (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.