fix(arrow/ipc): avoid deadlock on compression errors - #1142
fix(arrow/ipc): avoid deadlock on compression errors#1142fallintoplace wants to merge 2 commits into
Conversation
zeroshade
left a comment
There was a problem hiding this comment.
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.
ea41ee8 to
76d0c3b
Compare
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/ipcgo test -race ./arrow/ipc -run TestRecordEncoderCompressionErrorDoesNotDeadlockAre there any user-facing changes?
Parallel IPC compression now returns compressor failures instead of hanging.