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

Conversation

locker
Copy link
Member

@locker locker commented Apr 4, 2025

Before commit 6c5c8b7 ("Print luatest logs to stdout when unified log is disabled"), luatest implicitly configured the logger to operate in the non-blocking mode by using a pipe for the logs destination. Now, it uses a file albeit the file actually points to a pipe file descriptor. Tarantool thinks it's a regular file and writes all logs in the blocking mode. This leads to a deadlock if a test performs a lot of checks (which are logged) without yielding execution to the fiber processing logs because the size of a pipe is quite limited. Let's fix this issue by writing all logs through a pipe, as we did before. Let's also explicitly enable non-blocking logging to avoid breakages like this in future.

The fix isn't ideal because it may lead to dropping logs. We should probably handle logs emitted by the luatest runner in a separate process, like we do for processes spawned in tests.

Closes #416

Before commit 6c5c8b7 ("Print luatest logs to stdout when unified
log is disabled"), luatest implicitly configured the logger to operate
in the non-blocking mode by using a pipe for the logs destination.
Now, it uses a file albeit the file actually points to a pipe file
descriptor. Tarantool thinks it's a regular file and writes all logs in
the blocking mode. This leads to a deadlock if a test performs a lot
of checks (which are logged) without yielding execution to the fiber
processing logs because the size of a pipe is quite limited. Let's fix
this issue by writing all logs through a pipe, as we did before. Let's
also explicitly enable non-blocking logging to avoid breakages like this
in future.

The fix isn't ideal because it may lead to dropping logs. We should
probably handle logs emitted by the luatest runner in a separate
process, like we do for processes spawned in tests.

Closes tarantool#416
Copy link
Member

@Totktonada Totktonada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm OK with it taking it as a hotfix.

I think that we can bufferize luatest's output in runtime and actually call log.<level_func> from a separate fiber. That's similar to the test-run's problem with pipe buffer size.

@Totktonada Totktonada removed their assignment Apr 6, 2025
@locker locker merged commit a68aba4 into tarantool:master Apr 7, 2025
9 checks passed
@locker locker deleted the luatest-log-hang-fix branch April 7, 2025 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

luatest hangs if tests perform too many checks without yielding execution
2 participants