This repository was archived by the owner on Jan 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
This repository was archived by the owner on Jan 30, 2025. It is now read-only.
Nil panic calling Session.ID()
#509
Copy link
Copy link
Closed
Labels
Description
This seems to be a new flaky nil panic 😞 Spotted 2 times in #508 (job #1237 and #1240):
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x112daaa]
goroutine 1155 [running]:
github.com/grafana/xk6-browser/common.(*Session).ID(0x0)
/home/runner/work/xk6-browser/xk6-browser/common/session.go:77 +0x2a
github.com/grafana/xk6-browser/common.(*Page).sessionID(...)
/home/runner/work/xk6-browser/xk6-browser/common/page.go:922
github.com/grafana/xk6-browser/common.NewPage({0x1cace60?, 0xc0006548d0}, {0x1cb1d10?, 0x0}, 0xc000706b40, {0xc0000486c0, 0x20}, 0x0, 0x1, 0xc000705e30)
/home/runner/work/xk6-browser/xk6-browser/common/page.go:129 +0x7f1
github.com/grafana/xk6-browser/common.(*Browser).onAttachedToTarget(0xc000447e00, 0xc00065c0a0)
/home/runner/work/xk6-browser/xk6-browser/common/browser.go:287 +0xacf
github.com/grafana/xk6-browser/common.(*Browser).initEvents.func1()
/home/runner/work/xk6-browser/xk6-browser/common/browser.go:194 +0x425
created by github.com/grafana/xk6-browser/common.(*Browser).initEvents
/home/runner/work/xk6-browser/xk6-browser/common/browser.go:179 +0x35e
FAIL github.com/grafana/xk6-browser/tests 5.593s
? github.com/grafana/xk6-browser/tests/ws [no test files]
It happened in different tests, TestLocator/DispatchEvent
and TestElementHandleBoundingBoxInvisibleElement
.
We do a nil check before calling session.ID()
:
Lines 920 to 923 in 67499f7
func (p *Page) sessionID() (sid target.SessionID) { | |
if p != nil && p.session != nil { | |
sid = p.session.ID() | |
} |
But I suppose it's possible for that to race and session
to be nil after it? This is only called for logging, though session
shouldn't be nil at that point... 🤔
ankur22