Skip to content

Commit a687be1

Browse files
committed
Fix another small bug in ensureConstructorImpl().
This was pre-existing (before the containers changes). I'm not sure if it would have been possible to trigger in practice, I noticed just from looking at the code.
1 parent b6294dc commit a687be1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/workerd/io/worker.c++

+5-1
Original file line numberDiff line numberDiff line change
@@ -3506,7 +3506,11 @@ kj::Promise<void> Worker::Actor::ensureConstructedImpl(IoContext& context, Actor
35063506
handler.missingSuperclass = info.missingSuperclass;
35073507

35083508
impl->classInstance = kj::mv(handler);
3509-
}, kj::mv(inputLock));
3509+
}, inputLock.addRef());
3510+
// We addRef() the inputLock above rather than kj::mv() it so that the lock remains held
3511+
// through the catch block below, if an exception is thrown. This is important since we
3512+
// MUST update `impl->classInstance` to something other than `Initializing` before we
3513+
// release the lock.
35103514
} catch (...) {
35113515
// Get the KJ exception
35123516
auto e = kj::getCaughtExceptionAsKj();

0 commit comments

Comments
 (0)