Why Ruby's Timeout is dangerous (and Thread.raise is terrifying) (2015)

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  1. rack-timeout

    Abort requests that are taking too long

    The other answer is correct I believe, but I think the most common recommendation I've seen for rails boils down to "Use Timeout, and then kill and restart the process" (ref: [0], [1]), which obviously doesn't feel great for performance when a timeout in one thread can cause all other threads to need to be killed.

    [0] https://www.schneems.com/2017/02/21/the-oldest-bug-in-ruby-w...

    [1] https://github.com/zombocom/rack-timeout (c.f. term_on_timeout)

  2. SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
  3. datasette-ripgrep

    Web interface for searching your code using ripgrep, built as a Datasette plugin

    I'm fascinated by this general problem - I see it as a close relative of the "sandbox" problem, where I want to be able to safely run user-defined untrusted operations.

    For timeouts, I want to be able to build web application features which are guaranteed to terminate early after eg 2s in a way that resets all resources related to the operation.

    The best way I've found of doing this so far involves proceses: run the time-bound operation in an entirely separate process and terminate it early if necessary.

    I do that with "rg" here: https://github.com/simonw/datasette-ripgrep/blob/a40161f6273...

  4. RxJava

    RxJava – Reactive Extensions for the JVM – a library for composing asynchronous and event-based programs using observable sequences for the Java VM.

  5. Elixir

    Elixir is a dynamic, functional language for building scalable and maintainable applications

    The source code for Task is very readable but also kind of subtle, and makes for a good study. I would say definitely give it a shot to trace the flow from Task.async[0] to Task.await[1] to Task.Supervised.start_link[2] to Task.Supervised.reply[3]. There is some subtle interplay with regard to waiting for messages/timeouts and process links.

    [0] - https://github.com/elixir-lang/elixir/blob/v1.16.3/lib/elixi...

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Mastering Reactive Programming in Modern Mobile Development

    2 projects | dev.to | 10 Feb 2026
  • How to do threading in Android.

    2 projects | /r/androiddev | 24 Mar 2023
  • It hurts

    1 project | /r/ProgrammerHumor | 8 Jan 2023
  • What is your tech stack?

    4 projects | /r/androiddev | 14 Sep 2022
  • Reactive Data Streams - quick rxJava Summary

    1 project | dev.to | 28 Mar 2022

Did you know that Java is
the 10th most popular programming language
based on number of references?