Conversation
Opening a FIFO (named pipe) read-only blocks until a writer appears, so tsfile-cli hung forever on a FIFO input instead of failing with input problem 2 (code 37). Preflight the path with stat() on POSIX before open so non-regular files (FIFO/device/socket/directory) fail fast with E_INVALID_PATH, matching the existing post-open fstat() check and the Windows preflight. Add a FIFO regression case to the read-command input-failure e2e test.
ColinLeeo
force-pushed
the
colin/tsfile-143-fifo-hang
branch
from
September 30, 2026 10:05
499dda9 to
08d61c3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes TsFile-143: passing a FIFO (named pipe) as the TsFile input path makes
tsfile-clihang forever instead of failing fast.Problem
tsfile-cli meta <fifo>(andls/schema/stats/count/head/cat/sketch/export) blocks indefinitely with no output and no error.On POSIX,
open(path, O_RDONLY)on a FIFO blocks until a writer opens the other end. Since the CLI is a one-shot command with no writer, it waits forever — a script/CI caller is stuck until an external timeout kills it.The reader already had a post-open type check (
fstat+S_ISREG→E_INVALID_PATH), but that check is unreachable for FIFOs becauseopen()itself never returns. Device files and sockets are likewise only caught afteropen(), where they have their own special semantics.Requirement §3.1.2 says these special files must fail as "input problem 2" (
code 37), so the current behavior both violates the contract and turns the CLI into a non-terminating process.Fix
Preflight the path with
stat()(which follows symlinks) on POSIX, beforeopen(), mirroring the existing Windows_wstat64preflight:E_INVALID_PATH(code 37).stat()failures (missing file, dangling symlink) fall through to the normalopen()path, preservingE_FILE_OPEN_ERR(code 28).The check lives in
LocalRandomAccessReadFile::open, so it covers every read path (all read commands and library callers), matching the intent already documented next to the existing post-open check.Verification
invalid path (code 37), exit 2Added a FIFO regression case covering all read commands in
EmptyTreeAndInputFailuresHaveExactDiagnostics.