Skip to content

(Desktop) Fix livebook stdout closed on non-utf8 bytes - #3201

Merged
jonatanklosko merged 1 commit into
mainfrom
jk-stdout-writer-crash
Jul 14, 2026
Merged

(Desktop) Fix livebook stdout closed on non-utf8 bytes#3201
jonatanklosko merged 1 commit into
mainfrom
jk-stdout-writer-crash

Conversation

@jonatanklosko

@jonatanklosko jonatanklosko commented Jul 14, 2026

Copy link
Copy Markdown
Member

Closes #3200.

The desktop app spawns the Livebook Elixir node and reads stdout. If an invalid UTF-8 byte appears in the stdout, the reader finishes and effectively closes the pipe for writing. Once the pipe is closed, trying to log to stdout crashes the :user process, causing the reported issue. Elixir/Erlang code should not produce a byte like this, however a NIF might print anything.

The error can be reproduced by writing invalid byte directly to stdout descriptor:

File.write("/dev/fd/1", <<0xFF>>)
require Logger
Logger.error("Hello")
Logger.error("Hello")

Once the stdout is closed, it is corrupted as long as the app is running. When a runtime is restarted, any logging triggers the same :user crash.

@jonatanklosko
jonatanklosko merged commit a8b1fb4 into main Jul 14, 2026
3 checks passed
@jonatanklosko
jonatanklosko deleted the jk-stdout-writer-crash branch July 14, 2026 18:53
@wojtekmach

Copy link
Copy Markdown
Contributor

Thank you!

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.

Writer crash

3 participants