Skip to content

fix(arrow/ipc): avoid deadlock on compression errors - #1142

Open
fallintoplace wants to merge 2 commits into
apache:mainfrom
fallintoplace:fix/ipc-compression-deadlock
Open

fix(arrow/ipc): avoid deadlock on compression errors#1142
fallintoplace wants to merge 2 commits into
apache:mainfrom
fallintoplace:fix/ipc-compression-deadlock

Conversation

@fallintoplace

Copy link
Copy Markdown
Contributor

Rationale for this change

Parallel body compression sent worker errors through an unbuffered channel before the parent waited for the workers. A compressor failure could therefore leave the writer blocked forever, and the producer could continue sending work after the workers had stopped.

What changes are included in this PR?

Buffer the first worker error, make producer sends cancellation-aware, and add a regression test that uses a failing compressor with parallel compression.

Are these changes tested?

  • go test ./arrow/ipc
  • go test -race ./arrow/ipc -run TestRecordEncoderCompressionErrorDoesNotDeadlock

Are there any user-facing changes?

Parallel IPC compression now returns compressor failures instead of hanging.

@fallintoplace
fallintoplace marked this pull request as ready for review August 12, 2026 20:35

@zeroshade zeroshade left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The worker-pool changes prevent simultaneous compression failures from deadlocking, and the helper-level stress and race tests pass. However, recordEncoder.encode still discards the error returned by compressBodyBuffers, allowing the public writer paths to continue with a partially compressed payload and report success.

arrow/ipc/writer.go:544: compressBodyBuffers now returns the worker error without deadlocking, but this call discards it. A direct recordEncoder.Encode regression with failing compressors still returns nil, so Writer and FileWriter can continue with a partially compressed payload and report success. Please propagate this error and add an encoder- or writer-level regression that verifies it reaches the caller.

The PR also currently conflicts with main and will need rebasing.

@fallintoplace
fallintoplace force-pushed the fix/ipc-compression-deadlock branch from ea41ee8 to 76d0c3b Compare August 12, 2026 20: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.

2 participants