torrust-tracker icon indicating copy to clipboard operation
torrust-tracker copied to clipboard

Review missing timeouts

Open josecelano opened this issue 1 year ago • 2 comments

I've opened this issue to collect and track all past, current and future problems related to timeouts.

Recently we have had problems with the live demo because the http_health_check binary does not have a timeout. Healthchecks started by the docker daemon are waiting forever if they don't receive a response, consuming more and more resources until the container crashes.

There are more places where we could have such problems. I'm going to describe here some places potentially affected by this type of issue.

Potentially affected code

Healthcheck binary

It's used in the tracker but also in the Index.

It's currently being fixed:

  • [x] https://github.com/torrust/torrust-tracker/issues/597
  • [x] https://github.com/torrust/torrust-tracker/issues/604

Tracker API

It uses Axum. All services using Axum have the same problem. For more info see the issue opened in the Index. It applies the same here.

  • [ ] https://github.com/torrust/torrust-tracker/issues/612

HTTP Tracker

It also uses Axum.

  • [ ] https://github.com/torrust/torrust-tracker/issues/613

UDP Tracker

We do not use any framework. We handle requests directly with a loop.

  • We don't have timeouts.

  • If I'm not wrong all requests are executed sequentially. We don't use threads. If one request takes forever for some reason the server can not handle more requests and there is no timeout.

  • [x] https://github.com/torrust/torrust-tracker/issues/609

@da2ce7 is working on some improvements like:

  • Create a worker that can handle 50 requests at the most.
  • It spawns a new thread for each request.
  • It implements a graceful shutdown waiting for the active requests to finish when the application receives a halt signal.

I think he has not added yet the timeout feature.

By the way @WarmBeer since you are working on performance issues:

  • https://github.com/torrust/torrust-tracker/issues/565
  • https://github.com/torrust/torrust-tracker/issues/496

I wonder if improving the repository can improve the UDP tracker since requests are handled sequentially anyway or am I missing something @WarmBeer?

Tracker Checker

  • [x] https://github.com/torrust/torrust-tracker/issues/682
  • [x] https://github.com/torrust/torrust-tracker/issues/678
  • [x] https://github.com/torrust/torrust-tracker/issues/679
  • [x] https://github.com/torrust/torrust-tracker/issues/677

Conclusion

There might be other cases.

Relates to:

  • https://github.com/torrust/torrust-tracker/issues/324

josecelano avatar Jan 12 '24 15:01 josecelano

I wonder if improving the repository can improve the UDP tracker since requests are handled sequentially anyway or am I missing something @WarmBeer?

Yeah the performance improvements I'm working on only improve parallel access to the torrent repository. Sequential access should be the same.

https://github.com/torrust/torrust-tracker/issues/565

mickvandijke avatar Jan 24 '24 08:01 mickvandijke

All known issues on the server side have been solved. For the client side, @da2ce7 did it (at least for the Tracker Checker), but it's still pending to merge.

josecelano avatar May 15 '24 15:05 josecelano