ocsigen / lwt

OCaml promises and concurrent I/O
https://ocsigen.org/lwt
MIT License
708 stars 173 forks source link

Tell libev to use kqueue by default on macOS #601

Open aantron opened 6 years ago

aantron commented 6 years ago

On macOS, libev seems to default, too often, to select(2). Given that a major reason for using libev in the first place is to avoid select(2), we should have Lwt ask libev for its kqueue backend explicitly.

In other words, on macOS, new Lwt_engine.libev () should default to new Lwt_engine.(libev ~backend:Ev_backend.kqueue ()). See class Lwt_engine.libev.

cc @yallop, @anmonteiro as people who have been bitten by this.

aantron commented 6 years ago

See also #269, in which @yallop added support for choosing the backend.

aantron commented 4 years ago

libev should probably also be chosen by default on mac:

https://github.com/ocsigen/lwt/blob/ee466e23979644beb30f2d51a9835f5ffe34a3ab/src/unix/config/discover.ml#L860-L868

aantron commented 4 years ago

This also seems to be a duplicate of #87.

Marchhill commented 1 year ago

I am currently having problems with this. When I run: Lwt_engine.set (new Lwt_engine.libev ~backend:Lwt_engine.Ev_backend.kqueue ()); I get a segmentation fault. Are there any workarounds for this? Platform: macOS 12.5

raphael-proust commented 1 year ago

@Marchhill what Lwt version are you using? Can you reproduce on the HEAD of the master branch?
What ocaml version are you using?

I don't have a mac so I can't reproduce, but having the added info could help someone else check.