Skip to content

Commit 94ef449

Browse files
fix(vortex-file): avoid session lock re-entry in writer init
1 parent 7e5b081 commit 94ef449

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

vortex-file/src/writer.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,15 @@ impl VortexWriteOptions {
150150
// serialised array order is deterministic. The serialisation of arrays are done
151151
// parallel and with an empty context they can register their encodings to the context
152152
// in different order, changing the written bytes from run to run.
153-
let ctx = ArrayContext::new(self.session.arrays().registry().ids().sorted().collect())
153+
// Avoid calling `self.session.arrays()` multiple times in one expression.
154+
// `Ref` holds a session lock; reacquiring it in the same statement can deadlock.
155+
let registry = {
156+
let arrays = self.session.arrays();
157+
arrays.registry().clone()
158+
};
159+
let ctx = ArrayContext::new(registry.ids().sorted().collect())
154160
// Configure a registry just to ensure only known encodings are interned.
155-
.with_registry(self.session.arrays().registry().clone());
161+
.with_registry(registry);
156162
let dtype = stream.dtype().clone();
157163

158164
let (mut ptr, eof) = SequenceId::root().split();

0 commit comments

Comments
 (0)