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 when getting the DocumentID #577

Closed
2 tasks done
Tracked by #1138
ankur22 opened this issue Oct 10, 2022 · 1 comment
Closed
2 tasks done
Tracked by #1138

Nil when getting the DocumentID #577

ankur22 opened this issue Oct 10, 2022 · 1 comment
Assignees
Labels
bug Something isn't working next Might be eligible for the next planning (not guaranteed!)

Comments

@ankur22
Copy link
Collaborator

ankur22 commented Oct 10, 2022

Version: 508bcb8
Script: Complex script

At a certain point (always seems to be different, so it looks to be a race issue) I get:

running (00m07.0s), 1/1 VUs, 0 complete and 0 interrupted iterations
default   [   0% ] 1 VUs  00m07.0s/10m0s  0/1 shared iters
time="2022-10-10T17:51:51+01:00" level=info msg="\"@vp/tracking:7.0.1050\"" source=browser-console-api
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x68 pc=0x1013534b8]

goroutine 8117 [running]:
github.com/grafana/xk6-browser/common.(*Request).getDocumentID(...)
        github.com/grafana/xk6-browser@v0.0.0-00010101000000-000000000000/common/request.go:136
github.com/grafana/xk6-browser/common.(*NetworkManager).onLoadingFinished(0x14002153260, 0x14000c64990)
        github.com/grafana/xk6-browser@v0.0.0-00010101000000-000000000000/common/network_manager.go:400 +0x68
github.com/grafana/xk6-browser/common.(*NetworkManager).handleEvents(0x14002153260, 0x1400411e000)
        github.com/grafana/xk6-browser@v0.0.0-00010101000000-000000000000/common/network_manager.go:364 +0x140
github.com/grafana/xk6-browser/common.(*NetworkManager).initEvents.func1()
        github.com/grafana/xk6-browser@v0.0.0-00010101000000-000000000000/common/network_manager.go:345 +0x3c
created by github.com/grafana/xk6-browser/common.(*NetworkManager).initEvents
        github.com/grafana/xk6-browser@v0.0.0-00010101000000-000000000000/common/network_manager.go:344 +0x160
2022/10/10 17:51:52 [ERROR] exit status 2

Tasks

@ankur22 ankur22 added the bug Something isn't working label Oct 11, 2022
@inancgumus inancgumus added the next Might be eligible for the next planning (not guaranteed!) label Nov 30, 2023
@ankur22 ankur22 self-assigned this Jan 18, 2024
@ankur22
Copy link
Collaborator Author

ankur22 commented Jan 18, 2024

I've taken a look at the code and can see that it's a similar scenario to #1148 where it's easy to forget to check for the nil value before using it. I've audited the areas of the code that work with requestFromID (which was used to get the request that then led to a NPD when calling request. getDocumentID), and it looks like the correct nil checks are now in place. Nevertheless, I'll change the method signature of requestFromID so that it also returns a bool indicating whether the value was retrieved or not so that we don't make the same mistake again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working next Might be eligible for the next planning (not guaranteed!)
Projects
None yet
Development

No branches or pull requests

2 participants