chihaya / chihaya

A customizable, multi-protocol BitTorrent Tracker
https://chihaya.io
Other
1.44k stars 190 forks source link

frontend/udp: use a fixed number of coroutines #603

Open shyba opened 1 year ago

shyba commented 1 year ago

While investigating #524 chihaya was using a lot of memory until sigkill by oom.

I'm not sure if that is the same issue, but I experimented with a fixed number of coroutines through a channel. This greatly reduced the memory usage and it is now able to handle backpressure.

As I'm not a Go expert, I'm leaving this here as a suggestion. 128 was chosen arbitrarily. There is no impact on req/s but the server survives a long session of benchmark without running out of memory

shyba commented 1 year ago

Fixed lint, taking a look at that data race from tests... It doesn't happen locally, so I will compare go versions and environments.

shyba commented 1 year ago

I can confirm TestStartStopRaceIssue437 fails intermittently on main branch as well. This is the failure for #602 as well, if someone can please re-run there.

mrd0ll4r commented 1 year ago

I investigated that race, see https://github.com/chihaya/chihaya/issues/608. If you want, please try to fix that first :)