Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nil pointer: page.getFrameElement #4124

Open
inancgumus opened this issue Oct 18, 2023 · 2 comments
Open

nil pointer: page.getFrameElement #4124

inancgumus opened this issue Oct 18, 2023 · 2 comments

Comments

@inancgumus
Copy link
Member

inancgumus commented Oct 18, 2023

Brief summary

Test Run ID: 2015119

There is a nil pointer exception in:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x11af156]

goroutine 2213 [running]:
github.com/grafana/xk6-browser/common.(*Page).getFrameElement(0xc00225d1e0, 0xc002d50540)
github.com/grafana/xk6-browser@v1.1.0/common/page.go:274 +0x2d6
github.com/grafana/xk6-browser/common.(*Frame).FrameElement(0xc002d50540)
github.com/grafana/xk6-browser@v1.1.0/common/frame.go:834 +0x106
github.com/grafana/xk6-browser/common.(*ElementHandle).checkHitTargetAt(0xc0002d1a90, {0x19d8f28?, 0xc002a7ab60?}, {0x407eff2000000000, 0x407da00000000000})
github.com/grafana/xk6-browser@v1.1.0/common/element_handle.go:70 +0x6a
github.com/grafana/xk6-browser/common.(*ElementHandle).newPointerAction.func1({0x19d8f28, 0xc002a7ab60}, 0x0?)
github.com/grafana/xk6-browser@v1.1.0/common/element_handle.go:1449 +0x52b
github.com/grafana/xk6-browser/common.retryPointerAction({0x19d8f28, 0xc002a7ab60}, 0xc000ea60a0, 0xc000b3cf00)
github.com/grafana/xk6-browser@v1.1.0/common/element_handle.go:1488 +0x3c
github.com/grafana/xk6-browser/common.(*ElementHandle).newPointerAction.func2({0x19d8f28?, 0xc002a7ab60?}, 0xc000b3cf00?, 0x44f120?)
github.com/grafana/xk6-browser@v1.1.0/common/element_handle.go:1476 +0x35
github.com/grafana/xk6-browser/common.(*Frame).click.(*Frame).newPointerAction.func2({0x19d8f28, 0xc002a7ab60}, 0xc0009d3e00, 0xc0009d3e60)
github.com/grafana/xk6-browser@v1.1.0/common/frame.go:1991 +0x116
created by github.com/grafana/xk6-browser/common.call in goroutine 2212
github.com/grafana/xk6-browser@v1.1.0/common/helpers.go:102 +0x15c

xk6-browser version

1.1.0

OS

remote

Chrome version

remote

Docker version and image (if applicable)

No response

Steps to reproduce the problem

Run the test script locally.

Expected behaviour

No panics.

Actual behaviour

Panics.

@inancgumus inancgumus added the bug label Oct 18, 2023
@bandorko
Copy link
Contributor

bandorko commented Nov 9, 2023

Maybe related with the grafana/xk6-browser#1087
That issue produces similar panic:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x11af1d6]
goroutine 472 [running]:
github.com/grafana/xk6-browser/common.(*Page).getFrameElement(0xc000603d40, 0xc0002341c0)
        github.com/grafana/[email protected]/common/page.go:274 +0x2d6
github.com/grafana/xk6-browser/common.(*Frame).FrameElement(0xc0002341c0)
        github.com/grafana/[email protected]/common/frame.go:834 +0x106
github.com/grafana/xk6-browser/common.(*ElementHandle).checkHitTargetAt(0xc0010c8f50, {0x19d8f48?, 0xc000b05180?}, {0x404daa0000000000, 0x40433d70a3d70a3d})
        github.com/grafana/[email protected]/common/element_handle.go:70 +0x6a
github.com/grafana/xk6-browser/common.(*ElementHandle).Click.(*ElementHandle).newPointerAction.func2({0x19d8f48, 0xc000b05180}, 0x0?)
        github.com/grafana/[email protected]/common/element_handle.go:1449 +0x471
github.com/grafana/xk6-browser/common.retryPointerAction({0x19d8f48, 0xc000b05180}, 0xc000b5d120, 0xc00040ea20)
        github.com/grafana/[email protected]/common/element_handle.go:1488 +0x3c
github.com/grafana/xk6-browser/common.(*ElementHandle).Click.(*ElementHandle).newPointerAction.func3({0x19d8f48?, 0xc000b05180?}, 0x116d027?, 0xc001b56fa0?)
        github.com/grafana/[email protected]/common/element_handle.go:1476 +0x35
created by github.com/grafana/xk6-browser/common.call in goroutine 471
        github.com/grafana/[email protected]/common/helpers.go:102 +0x15c

@ankur22
Copy link
Contributor

ankur22 commented Nov 20, 2024

test run: 3531167

Similar stack trace:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x15900db]

goroutine 1085505 [running]:
github.com/grafana/xk6-browser/common.NewJSHandle(...)
github.com/grafana/[email protected]/common/js_handle.go:65
github.com/grafana/xk6-browser/common.(*ExecutionContext).adoptBackendNodeID(0xc00dab96b0, 0x0)
github.com/grafana/[email protected]/common/execution_context.go:116 +0x37b
github.com/grafana/xk6-browser/common.(*Frame).adoptBackendNodeID(0xc009e30380, {0x1c1e3ad, 0x4}, 0x0)
github.com/grafana/[email protected]/common/frame.go:2060 +0x242
github.com/grafana/xk6-browser/common.(*Page).getFrameElement(0xc002a6fa00, 0xc00a61c8c0)
github.com/grafana/[email protected]/common/page.go:622 +0x3c5
github.com/grafana/xk6-browser/common.(*Frame).FrameElement(0xc00a61c8c0)
github.com/grafana/[email protected]/common/frame.go:1008 +0xf8
github.com/grafana/xk6-browser/common.(*ElementHandle).checkHitTargetAt(0xc0051759a0, {0x1f9ad78?, 0xc0127ef1f0?}, {0x4082e55000000000, 0x407ac60000000000})
github.com/grafana/[email protected]/common/element_handle.go:72 +0x77
github.com/grafana/xk6-browser/common.(*ElementHandle).newPointerAction.func1({0x1f9ad78, 0xc0127ef1f0}, 0x0?)
github.com/grafana/[email protected]/common/element_handle.go:1627 +0x517
github.com/grafana/xk6-browser/common.retryPointerAction({0x1f9ad78, 0xc0127ef1f0}, 0xc00f3741a0, 0xc0205550e0)
github.com/grafana/[email protected]/common/element_handle.go:1672 +0x3c
github.com/grafana/xk6-browser/common.(*ElementHandle).newPointerAction.func2({0x1f9ad78, 0xc0127ef1f0}, 0xc027172c40, 0xc027172cb0)
github.com/grafana/[email protected]/common/element_handle.go:1654 +0x59
github.com/grafana/xk6-browser/common.(*Frame).click.(*Frame).newPointerAction.func2({0x1f9ad78, 0xc0127ef1f0}, 0xc027172c40, 0xc027172cb0)
github.com/grafana/[email protected]/common/frame.go:2208 +0x116
created by github.com/grafana/xk6-browser/common.call in goroutine 1085504
github.com/grafana/[email protected]/common/helpers.go:103 +0x14c

It looks like a CDP request could return nil or a null subtype which is not what we expect (found this in PW).

  1. Reproduce this.
  2. Protect against this and know what the workaround is for this scenario.

@ankur22 ankur22 transferred this issue from grafana/xk6-browser Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants