Replies: 1 comment
-
Hi @LBouet, We recently tackled an issue (#1163) where we forced the caller to check that the second return value was On closer inspection it does feel prudent to check for The original issue was filed under #986. |
Beta Was this translation helpful? Give feedback.
-
During a high-load GUI test, opening a new tab may randomly cause this memory error.
This error causes the test to crash.
///////////////// ERROR START \\\\\\\\\\
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x11f693a]
goroutine 10990869 [running]:
github.com/grafana/xk6-browser/common.(*Frame).requestByID(0xc212056fc0, {0xc1a600cf10, 0xa})
github.com/grafana/[email protected]/common/frame.go:412 +0x5a
github.com/grafana/xk6-browser/common.(*FrameManager).requestFailed(0xc1338a9500, 0xc1954437c0, 0x0)
github.com/grafana/[email protected]/common/frame_manager.go:454 +0x499
github.com/grafana/xk6-browser/common.(*NetworkManager).onLoadingFailed(0xc003f8ef00, 0xc0c29964e0)
github.com/grafana/[email protected]/common/network_manager.go:374 +0x111
github.com/grafana/xk6-browser/common.(*NetworkManager).handleEvents(0xc003f8ef00, 0xc2206f4480)
github.com/grafana/[email protected]/common/network_manager.go:347 +0x278
github.com/grafana/xk6-browser/common.(*NetworkManager).initEvents.func1()
github.com/grafana/[email protected]/common/network_manager.go:330 +0x31
created by github.com/grafana/xk6-browser/common.(*NetworkManager).initEvents in goroutine 10840679
github.com/grafana/[email protected]/common/network_manager.go:329 +0x13d
\\\\\\\\\\\ ERROR END //////////////////////////
It seems that in the initial code, if the frame session and the main frame session are null, null is not returned.
This fix allows you to return a null if the frames are null and no longer get the error.
To be tested by your teams before integrating it.
-> Function to be updated : FRAME.GO
func (f *Frame) requestByID(reqID network.RequestID) Request {
frameSession := f.page.getFrameSession(cdp.FrameID(f.ID()))
if frameSession == nil {
frameSession = f.page.mainFrameSession
}
/ ADD from "LoadTestingTeam" --- START /
if frameSession == nil {
return nil
} else {
return frameSession.networkManager.requestFromID(reqID)
}
/ ADD from LoadTestingTeam --- STOP */
/* DEL from LoadTestingTeam
return frameSession.networkManager.requestFromID(reqID)*/
}
Beta Was this translation helpful? Give feedback.
All reactions