Skip to content

Commit

Permalink
Fix deadlock with executionContextMu (#636)
Browse files Browse the repository at this point in the history
executionContextMu isn't needed to be locked and unlocked in this
(WaitForFunction) method as it doesn't r/w to executionContext or
documentHandle. This function later calls an unexported method with the
same name, which does require access to executionContext.

A deadlock was occurring later in waitForExecutionContext since
this method was holding on to the lock.

Closes: #635
  • Loading branch information
ankur22 committed Nov 11, 2022
1 parent 8bef8b9 commit 6aebf19
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions common/frame.go
Original file line number Diff line number Diff line change
Expand Up @@ -1789,9 +1789,6 @@ func (f *Frame) WaitForFunction(fn goja.Value, opts goja.Value, jsArgs ...goja.V
k6ext.Panic(f.ctx, "parsing waitForFunction options: %w", err)
}

f.executionContextMu.RLock()
defer f.executionContextMu.RUnlock()

js := fn.ToString().String()
_, isCallable := goja.AssertFunction(fn)
if !isCallable {
Expand Down

0 comments on commit 6aebf19

Please sign in to comment.