msquic icon indicating copy to clipboard operation
msquic copied to clipboard

Fix kqueue issues on FreeBSD

Open scopedog opened this issue 3 years ago • 10 comments

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.

scopedog avatar Sep 13 '22 21:09 scopedog

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.

scopedog avatar Sep 13 '22 22:09 scopedog

/azp run

nibanks avatar Sep 15 '22 15:09 nibanks

Azure Pipelines successfully started running 2 pipeline(s).

azure-pipelines[bot] avatar Sep 15 '22 15:09 azure-pipelines[bot]

Your changes break macOS.

nibanks avatar Sep 15 '22 16:09 nibanks

The latest one is just merge from main or do you think my previous changes affect it?

scopedog avatar Sep 15 '22 16:09 scopedog

It's the first time I've run Azure Pipelines, so I suspect it always has been broken.

nibanks avatar Sep 15 '22 17:09 nibanks

I'm not sure why WAN perf results were pushed to your PR. Could you please force push and revert that commit?

nibanks avatar Sep 16 '22 12:09 nibanks

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.

nibanks avatar Sep 16 '22 12:09 nibanks

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.

scopedog avatar Sep 16 '22 13:09 scopedog

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.

scopedog avatar Sep 16 '22 16:09 scopedog

Closing this old PR as inactive.

nibanks avatar Jan 12 '23 13:01 nibanks