-
Notifications
You must be signed in to change notification settings - Fork 1.3k
PoC libuv instead of libevent #7770
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
base: main
Are you sure you want to change the base?
Conversation
|
@ckerr Please ACK. Are you interested in me helping to improve this? |
|
@nevack I'm extremely interested in seeing work on this, yes! 😻 The big question IMO is the choice of library and I'd like to see how strongly you feel about using libuv here. In libuv's favor:
In standalone asio's favor:
Even though I'm less familiar with asio, it seems like it has much more upside for libtransmission's needs. WDYT? Would you be open to the idea of using that instead of libuv? |
To be completely honest — not at all.
I don’t really have a strong preference. What I do see as a challenge with libuv is the additional research needed for HTTP server implementation. I don’t currently know of any lightweight and modern library that can be used in Transmission alongside libuv, and I don’t think a modern HTTP server is something that’s easily hand‑rolled 😄
Yeah, I'm okay with that. Here’s my proposal: In the current implementation, you can see that many class hierarchies are duplicated. What really needs to be done is to abstract these classes away from the specific event-handling library used so that the implementation can be swapped between libevent, libuv, asio, or something new in the future. Some parts are already reasonably well abstracted:
Creating proper abstraction would even allow us to compare implementations and decide which one to pursue further. Do you agree with this proposal? |
|
I agree on the idea of an abstraction layer. Violating that principle is what's made it so time-consuming to pry libevent out of libtransmission. If I'm reading your last comment right, the next step you want me to do is review abstractions like |
Yes, that would be a great starting point. Thank you! I will push revised code now with fixed code style check. |
|
self-assigning for the subtask of reviewing the abstractions introduced in this PoC as per #7770 (comment) |
macosx/CMakeLists.txt
Outdated
| fmt::fmt-header-only | ||
| vdkqueue | ||
| ${SPARKLE_FRAMEWORK} | ||
| "-L/opt/homebrew/lib/ -luv" # TODO: proper libuv library intergration into the build infra. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: intergration -> integration
|
We hope a change into the libevent project team members... |
|
@ckerr Some progress update from my end. Moved everything Also moved So, as previously said, I continued working on two distinct parts here:
|
|
Introduced |
|
I'm definitely interested in this work. I have zero experience with libuv and asio. So before I familiarise myself, please carry on without me. What I can do though is help evaluate the abstraction layers. I'll try get my hands on them soon. |
At least I'm not alone here 😄
That would definitely help, thank you! I preserved commit history for now, so you can see step-by-step progress if needed. |
|
Just a courtesy checkin: Even though I've been active in other PRs and quiet on this one, I haven't forgotten about this. It's just a "heavier" PR that I need to have a good block of time to stare at & think about. |
By saying "At least I'm not alone here" I really meant "I'm not alone in having very little experience with libuv or asio." |
|
I missed that. Thanks for the clarification but FWIW I didn't read it that way at all! I was just wanting to check in because of the 2025 track record of letting some PRs gather dust 👍 |
|
Tests crash on Debian 11 with My investigation lead me to this: https://packages.debian.org/bullseye/libuv1-dev That's a bummer 😞 |
|
There are still can be some object lifetime issues as can be seen in previous runs of sanitizer tests. |
|
This is getting a bit out of hand with 38 commits, but I've got so far:
I think I won't spend more time on this before some initial review, as I just don't know what else can be done here. For @ckerr and @tearfurI suggest to ignore all build stuff, it's a mess for now, this PR is PoC and Draft for a reason. For @ckerrIf we decide to go with libuv impl, maybe I have found a solution for http server. |
|
I want to help review/test this, and I think I may have some time for that this weekend, but I wanted to make one comment on something in this thread: please, please do not replace libcurl as the http client unless the replacement has support for connection reuse and multiplexing. Transmission might the only client that gets this right, and it truly matters with 10k+ announces when it comes to tracker traffic. That's not even to mention what the trackers see, you can measure it in GBs. To me this would be a devastating efficiency regression. |
|
I tested this on OpenBSD. It builds with a dependency on the libuv in /usr/local/lib. |
|
Small update: I've looked at this PR, and this overlapped with a |
Very rough 1to1 implementation based on libuv instead of libevent.
It is functional, tested with macOS client.
The solely purpose of this PR is just to provide a bootstrap for @ckerr
#2462 (comment)
For now, only tr_peerIo is somewhat properly abstracted from async event library.
tr_session (especially BoundSocket) and tr_session_thread also need some real abstraction.
Left out of scope:
Afterthoughts: Maybe, just maybe, asio is the path forward, it is a C++ library after all. Also there's uvw, a C++ wrapper around libuv, but I did not want to get into this before getting working plain libuv impl.