epoll-shim icon indicating copy to clipboard operation
epoll-shim copied to clipboard

TestSynchWaitableTimer test from FreeRDP hangs

Open jiixyj opened this issue 3 years ago • 3 comments

straceing ./Testing/TestSynch "TestSynchWaitableTimer" on Linux doesn't show anything too unusual:

timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK) = 3
timerfd_settime(3, 0, {it_interval={tv_sec=0, tv_nsec=0}, it_value={tv_sec=1, tv_nsec=500000000}}, NULL) = 0
poll([{fd=3, events=POLLIN}], 1, -1)    = 1 ([{fd=3, revents=POLLIN}])
read(3, "\1\0\0\0\0\0\0\0", 8)          = 8
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0x12), ...}) = 0
write(1, "Timer Signaled\n", 15)        = 15
poll([{fd=3, events=POLLIN}], 1, 2000)  = 0 (Timeout)
timerfd_settime(3, 0, {it_interval={tv_sec=1, tv_nsec=200000000}, it_value={tv_sec=1, tv_nsec=200000000}}, NULL) = 0
poll([{fd=3, events=POLLIN}], 1, -1)    = 1 ([{fd=3, revents=POLLIN}])
read(3, "\1\0\0\0\0\0\0\0", 8)          = 8
write(1, "Timer Signaled\n", 15)        = 15
timerfd_settime(3, 0, {it_interval={tv_sec=1, tv_nsec=200000000}, it_value={tv_sec=1, tv_nsec=200000000}}, NULL) = 0
poll([{fd=3, events=POLLIN}], 1, -1)    = 1 ([{fd=3, revents=POLLIN}])
read(3, "\1\0\0\0\0\0\0\0", 8)          = 8
write(1, "Timer Signaled\n", 15)        = 15
close(3)                                = 0

jiixyj avatar Mar 23 '21 07:03 jiixyj

On FreeBSD 13.0-STABLE the test works and the timerfd calls are mapped to kqueue like this:

0.045275867 0.000082134 kqueue()                 = 3 (0x3)
0.045558305 0.000071239 mmap(0x0,135168,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34372382720 (0x800c0f000)
0.045938800 0.000067886 clock_gettime(4,{ 350.942356859 }) = 0 (0x0)
0.046403384 0.000231873 kevent(3,{ 0,EVFILT_TIMER,EV_ADD|EV_ONESHOT,NOTE_USECONDS,0x16e360,0x0 },1,0x0,0,0x0) = 0 (0x0)
1.547382699 1.500708889 poll({ 3/POLLIN },1,-1)  = 1 (0x1)
1.548269124 0.000393625 kevent(3,0x0,0,{ 0,EVFILT_TIMER,EV_ONESHOT|EV_CLEAR,0,0x1,0x0 },1,{ 0.000000000 }) = 1 (0x1)
1.548857467 0.000230197 clock_gettime(4,{ 352.445181100 }) = 0 (0x0)
1.549737467 0.000351441 fstat(1,{ mode=crw--w---- ,inode=115,size=0,blksize=4096 }) = 0 (0x0)
1.550717480 0.000408153 ioctl(1,TIOCGETA,0x7fffffffd710) = 0 (0x0)
Timer Signaled
1.551246597 0.000197790 write(1,"Timer Signaled\n",15) = 15 (0xf)
3.564560580 2.013153627 poll({ 3/POLLIN },1,2000) = 0 (0x0)
3.565522155 0.000357308 clock_gettime(4,{ 354.461791591 }) = 0 (0x0)
3.566552733 0.000459556 kevent(3,{ 0,EVFILT_TIMER,EV_ADD|EV_ONESHOT,NOTE_USECONDS,0x124f80,0x0 },1,0x0,0,0x0) = 0 (0x0)
4.767112860 1.199982121 poll({ 3/POLLIN },1,-1)  = 1 (0x1)
4.768361342 0.000567390 kevent(3,0x0,0,{ 0,EVFILT_TIMER,EV_ONESHOT|EV_CLEAR,0,0x1,0x0 },1,{ 0.000000000 }) = 1 (0x1)
4.769323476 0.000482464 clock_gettime(4,{ 355.665454068 }) = 0 (0x0)
4.770014905 0.000131581 kevent(3,{ 0,EVFILT_TIMER,EV_ADD|EV_ONESHOT,NOTE_USECONDS,0x124132,0x0 },1,0x0,0,0x0) = 0 (0x0)
Timer Signaled
4.770339806 0.000140800 write(1,"Timer Signaled\n",15) = 15 (0xf)
4.770800759 0.000132978 clock_gettime(4,{ 355.667185293 }) = 0 (0x0)
4.771573203 0.000509841 kevent(3,{ 0,EVFILT_TIMER,EV_ADD|EV_ONESHOT,NOTE_USECONDS,0x124f80,0x0 },1,0x0,0,0x0) = 0 (0x0)
5.972437559 1.200364572 poll({ 3/POLLIN },1,-1)  = 1 (0x1)
5.973528200 0.000510958 kevent(3,0x0,0,{ 0,EVFILT_TIMER,EV_ONESHOT|EV_CLEAR,0,0x1,0x0 },1,{ 0.000000000 }) = 1 (0x1)
5.974636721 0.000444470 clock_gettime(4,{ 356.870884926 }) = 0 (0x0)
5.975952810 0.000509841 kevent(3,{ 0,EVFILT_TIMER,EV_ADD|EV_ONESHOT,NOTE_USECONDS,0x12410d,0x0 },1,0x0,0,0x0) = 0 (0x0)
Timer Signaled
5.976964391 0.000316241 write(1,"Timer Signaled\n",15) = 15 (0xf)
5.977941331 0.000401448 close(3)                 = 0 (0x0)
5.980596976 0.001914489 exit(0x0)

jiixyj avatar Mar 23 '21 07:03 jiixyj

I just tested a transcribed version of the Linux syscalls with epoll-shim on OpenBSD (6.8 GENERIC.MP#98 amd64) and that seems to work, so no idea why that hang happened.

jiixyj avatar Mar 23 '21 08:03 jiixyj