File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ( ) ;
You can’t perform that action at this time.
0 commit comments