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

linux user signals leak file descriptors #91

Open
arr2036 opened this issue Jun 19, 2020 · 4 comments
Open

linux user signals leak file descriptors #91

arr2036 opened this issue Jun 19, 2020 · 4 comments
Labels

Comments

@arr2036
Copy link
Collaborator

arr2036 commented Jun 19, 2020

Under some conditions the user signal tests leak exactly one file descriptor. Seems like the issue is in the code itself not the tests.

The tests are broken too however, ./test/libkqueue-test user -n 2 results in

[/home/arr2036/Repositories/dependencies/libkqueue/test/user.c:109]: kevent_cmp() failed:
  expected [ident=2, filter=-11, flags = 16 (EV_ONESHOT), fflags = 0, data=0, udata=(nil)]
  but got  [ident=2, filter=-11, flags = 16 (EV_ONESHOT), fflags = 0, data=0, udata=(nil)]

which is interesting...

@arr2036 arr2036 added the bug label Jun 19, 2020
@arr2036
Copy link
Collaborator Author

arr2036 commented Jun 19, 2020

Also if you change the tests to use their own ident numbers they start failing too.

@jpereira
Copy link
Contributor

The repeated output looks to be due to the static buffer in kevent_to_str(). I did that test https://github.com/mheily/libkqueue/compare/master...jpereira:fix5?expand=1 and now is printing out correctly the difference between the buffers.

@arr2036
Copy link
Collaborator Author

arr2036 commented Sep 7, 2021

Confirmed, thanks.

The actual error is:

[/home/arr2036/Documents/Repositories/dependencies/libkqueue/test/user.c:113]: kevent_cmp() failed:
expected [ident=2, filter=-11 (EVFILT_USER), flags = 16 (EV_ONESHOT), fflags=0x0000 (), data=0, udata=(nil)]
but got  [ident=2, filter=-11 (EVFILT_USER), flags = 32 (EV_CLEAR), fflags=0x0000 (), data=0, udata=(nil)]
***** ERROR: Program received signal 6 *****

@arr2036
Copy link
Collaborator Author

arr2036 commented Sep 7, 2021

On run 1

KQ [22802]: kevent_copyin(): nchanges=1 nevents=0
KQ [22802]: kevent_copyin_one(): src={ ident=2, filter=-11 (EVFILT_USER), flags=0x0011 (EV_ADD EV_ONESHOT), fflags=0x0000 (), data=0, udata=(nil) }
KQ [22802]: linux_evfilt_user_knote_create(): event_fd=7 - created
KQ [22802]: kevent_copyin_one(): kn=0x5626ae3812f0 - created knote { ident=2, filter=-11 (EVFILT_USER), flags=0x0011 (EV_ADD EV_ONESHOT), fflags=0x0000 (), data=0, udata=(nil) }
KQ [22802]: kevent(): unlocked &(kq)->kq_mtx

Run 2

2802]: kevent_copyin(): nchanges=1 nevents=0
KQ [22802]: kevent_copyin_one(): src={ ident=2, filter=-11 (EVFILT_USER), flags=0x0011 (EV_ADD EV_ONESHOT), fflags=0x0000 (), data=0, udata=(nil) }
KQ [22802]: kevent_copyin_one(): kn=0x5626ae3813e0 - resolved ident=2 to knote
KQ [22802]: kevent_copyin_one(): kn=0x5626ae3813e0 - kn_modify rv=0
KQ [22802]: kevent(): unlocked &(kq)->kq_mtx

So I guess EV_ONESHOT isn't working correctly here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants