msquic
msquic copied to clipboard
Fix kqueue issues on FreeBSD
Description
Fix some issues regarding kqueue on FreeBSD. Will work also for MacOS.
Testing
Tested with src/tools/sample/sample.c and data transmission works between a client and a server and the server terminates by pressing ENTER. Further tests will be necessary.
I'm not very confident if the code is correct. Also, I noticed FreeBSD consumes much more CPU power than Linux. I tested the same program on FreeBSD and Linux with the same hardware and FreeBSD uses three times as much power as Linux.
So, registering an EVFILT_USER event once by
EV_SET(&Event, *queue, EVFILT_USER, EV_ADD | EV_CLEAR, 0, 0, NULL);
and triggering the EVFILT_USER event by
EV_SET(&event, *queue, EVFILT_USER, 0, NOTE_TRIGGER, 0, user_data);
seems to be a correct procedure.
/azp run
Azure Pipelines successfully started running 2 pipeline(s).
Your changes break macOS.
The latest one is just merge from main or do you think my previous changes affect it?
It's the first time I've run Azure Pipelines, so I suspect it always has been broken.
I'm not sure why WAN perf results were pushed to your PR. Could you please force push and revert that commit?
I'm not sure why WAN perf results were pushed to your PR. Could you please force push and revert that commit?
I figured it out. Because you're using your main branch, your GitHub Action ran and merged it: https://github.com/scopedog/msquic-freebsd/actions/runs/3061729929/jobs/4947078488. We need to fix this on our side to make sure these actions don't run down level.
OK. Sorry about that but what should I do? By the way, I'm currently testing the MacOS version and am checking the results. I'll post them later.
Here are the test results of make test:
Main repo:
Start 1: msquiccoretest
1/3 Test #1: msquiccoretest ................... Passed 17.18 sec
Start 2: msquicplatformtest
2/3 Test #2: msquicplatformtest ...............***Exception: SegFault 7.71 sec
Start 3: msquictest
3/3 Test #3: msquictest .......................***Failed 22.93 sec
My FreeBSD repo:
Start 1: msquiccoretest
1/3 Test #1: msquiccoretest ................... Passed 17.00 sec
Start 2: msquicplatformtest
2/3 Test #2: msquicplatformtest ...............***Exception: SegFault 7.58 sec
Start 3: msquictest (never ends)
These are the same on both Mac and FreeBSD.
The results of src/tools/sample/sample.c (both server and client run on localhost):
Main repo:
Mac: The server terminates by pressing ENTER.
FreeBSD: The server doesn't terminate by pressing ENTER.
My FreeBSD repo:
Mac: The server terminates by pressing ENTER.
FreeBSD: The server terminates by pressing ENTER.
It looks like the behaviors are a little different between Mac and FreeBSD but it may be due to the timing between threads. By the way, what test failed in your run?
I could investigate more but will need to focus on my job soon.
Closing this old PR as inactive.