Skip to content
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

Fix: opening/reading from fifo/chardev files are blocking the thread #14255

Commits on Jan 26, 2024

  1. Fix: opening/reading from fifo/chardev files are blocking the thread

    Disk files are always opened in a blocking way because epoll (for
    instance) will always say that a file is ready for reach or write. But
    this is only for regular disk files, and that doesn't apply to pipes and
    characters devices for example.
    
    Opening `/dev/tty` (a character device) will block the current thread
    when trying to read from it until you start typing on the keyboard.
    IO::FileDescriptor was taking care to check the file type, but File
    always told it to be blocking.
    
    Worse, trying to open a fifo/pipe file will block the current thread
    until another thread or process also opens it, which means that we must
    determine whether to block _before_ trying to open a file (not change it
    afterwards).
    
    I also added a `blocking` parameter to `File.open` and `File.new`.
    ysbaddaden committed Jan 26, 2024
    Configuration menu
    Copy the full SHA
    44a1b5e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f209e08 View commit details
    Browse the repository at this point in the history

Commits on Jan 29, 2024

  1. Require explicit blocking parameter to File

    Removes the automatic detection of the file type and blocking behavior
    before opening the file as we must support at least EINTR and ENXIO
    return values for `open(2)`.
    
    Blocking still defaults to true. Developers may pass nil for auto
    detection or false to force the nonblocking flag (after open).
    
    Opening a fifo without another thread/process also trying to open for
    read or write will still block the current thread (will be another PR).
    ysbaddaden committed Jan 29, 2024
    Configuration menu
    Copy the full SHA
    46146a5 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    23d99d8 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5cd6e7a View commit details
    Browse the repository at this point in the history

Commits on Feb 6, 2024

  1. Fix: don't run thread specs with the interpreter

    Starting threads very likely requires support from the interpreter to
    create the thread (so it knows about it) to run the interpreted code in.
    
    This also fixes the "can't resume running fiber" exceptions that started
    appearing in the wait group pull request, because they were always run
    after the thread related specs.
    ysbaddaden committed Feb 6, 2024
    Configuration menu
    Copy the full SHA
    60cef61 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a5d8f64 View commit details
    Browse the repository at this point in the history