Skip to content

Fix deadlock in case test performs lots of checks without yielding #417

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

Merged
merged 1 commit into from
Apr 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions luatest/log.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ function log.initialize(options)
output_beautifier:enable()

-- Redirect all logs to the pipe created by OutputBeautifier.
local log_cfg = string.format('/dev/fd/%d', output_beautifier.pipes.stdout[1])
--
-- Write through a pipe to enable non-blocking mode. Required to prevent
-- a deadlock in case a test performs a lot of checks without yielding
-- execution to the fiber processing logs (gh-416).
local log_cfg = string.format('| cat > /dev/fd/%d',
output_beautifier.pipes.stdout[1])

-- Logging cannot be initialized without configuring the `box` engine
-- on a version less than 2.5.1 (see more details at [1]). Otherwise,
Expand All @@ -59,7 +64,10 @@ function log.initialize(options)
-- Initialize logging for luatest runner.
-- The log format will be as follows:
-- YYYY-MM-DD HH:MM:SS.ZZZ [ID] main/.../luatest I> ...
require('log').cfg{log = log_cfg}
require('log').cfg{
log = log_cfg,
nonblock = true,
}
end

is_initialized = true
Expand Down
Loading