Skip to content
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

[SR-7316] libdispatch: DISPATCH_SOURCE_TYPE_DATA_* does not work with the epoll backend (linux) #658

Open
swift-ci opened this issue Mar 31, 2018 · 0 comments

Comments

@swift-ci
Copy link

Previous ID SR-7316
Radar None
Original Reporter moshe (JIRA User)
Type Bug
Environment

Fedora 27 with Clang 5.0.1

Additional Detail from JIRA
Votes 0
Component/s libdispatch
Labels Bug
Assignee None
Priority Medium

md5: fe128027ec00cf3b8931697f12b72939

Issue Description:

The following C program will crash for me:

#include <dispatch/dispatch.h>

int main(int argc, char **argv, char **envp) {
{{ dispatch_queue_t main_queue = dispatch_get_main_queue();}}
{{ dispatch_source_t source = dispatch_source_create(DISPATCH_SOURCE_TYPE_DATA_ADD, 0, 0, main_queue);}}
{{ dispatch_resume(source);}}
{{ dispatch_main();}}
};

The issue is within _dispatch_muxnote_create of the epoll backend, this code hits the DISPATCH_INTERNAL_CRASH on line src/event/event_epoll.c:200.

Adding a case for DISPATCH_EVFILT_CUSTOM_ADD in that switch statement solves the crash, but I don't actually know what it is supposed to do if I add it. Limited testing (with actual event handlers) did not uncover any obvious bugs for me with no code in the case.

Installing a kqueue/kevent compatibility library and changing the build to use the kevent backend also works on my linux installation. I guess the epoll backend should be fixed, but in addition, I would like to propose a build time option to switch the backend on linux systems that have kqueue/kevent.

(DISPATCH_SOURCE_TYPE_DATA_OR has the same issue.)

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant