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

Timeout error when closing the browser before the page #4480

Open
inancgumus opened this issue Dec 8, 2021 · 0 comments
Open

Timeout error when closing the browser before the page #4480

inancgumus opened this issue Dec 8, 2021 · 0 comments

Comments

@inancgumus
Copy link
Member

inancgumus commented Dec 8, 2021

Discovered by grafana/xk6-browser#141.

For this test:

func TestPageGoto(t *testing.T) {
	t.Parallel()

	b := testBrowser(t, withFileServer())

	p := b.NewPage(nil)

	url := b.staticURL("empty.html")
	r := p.Goto(url, nil)

	assert.Equal(t, url, r.URL(), `expected URL to be %q, result of navigation was %q`, url, r.URL())
}

This error may happen sometimes:

--- FAIL: TestPageGoto (30.93s)
panic: timed out [recovered]
        panic: timed out

1: running [Created by testing.(*T).Run @ testing.go:1306]
    testing  testing.go:1209             tRunner.func1.2(*T(#1), func(#4))
    testing  testing.go:1212             tRunner.func1()
             panic.go:1047               panic(interface{}{#1, grafana/xk6-browser#4})
    common   util.go:36                  Throw(...)
    common   frame_manager.go:444        (*FrameManager).NavigateFrame(*FrameManager(0xc001a66000), *Frame(#2), string(#3, len=40), Value{0x0, 0x0})
    common   frame.go:721                (*Frame).Goto(*Frame(#2), string(#3, len=40), Value{0x0, 0x0})
    common   page.go:462                 (*Page).Goto(*Page(0xc001828900), string(#3, len=40), Value{0x0, 0x0})
    tests    page_test.go:41             TestPageGoto(*T(0x0))
    testing  testing.go:1259             tRunner(*T(0xc000b53a00), func(0x2408388))
1: chan receive
    testing  testing.go:1225             tRunner.func1()
    testing  testing.go:1265             tRunner(*T(#96), func(#98))
    testing  testing.go:1596             runTests(func(#97), []InternalTest(0x1f len=31 cap=0), Time{#16, grafana/xk6-browser#12, <nil>})
    testing  testing.go:1504             (*M).Run(*M(#97))
    main     :103                        main()
1: chan receive [Created by common.(*Browser).initEvents.func1 @ browser.go:169]
    common   event_emitter.go:153        (*BaseEventEmitter).sync(*BaseEventEmitter(#598), func(#597))
    common   event_emitter.go:178        (*BaseEventEmitter).emit(*BaseEventEmitter(#598), string(#7, len=5), interface{}{#6, grafana/xk6-browser#598})
    common   page.go:155                 (*Page).didClose(*Page(#598))
    common   browser.go:282              (*Browser).onDetachedFromTarget(*Browser(#576), *EventDetachedFromTarget(#639))
27: select [Created by common.NewConnection @ connection.go:147]
    common   connection.go:216           (*Connection).handleIOError(*, {#8, grafana/xk6-browser#10})
    common   connection.go:258           (*Connection).recvLoop(*)
61: select [Created by common.(*NetworkManager).initEvents @ network_manager.go:255]
    common   network_manager.go:262      (*NetworkManager).handleEvents(*, *)
    common   network_manager.go:256      (*NetworkManager).initEvents.func1()
1: runnable [Created by chromium.(*Allocator).Allocate @ allocator.go:229]
    syscall  sys_darwin.go:44            syscall6(uintptr(#5), uintptr(#604), uintptr(#479), uintptr(0x0))
    syscall  zsyscall_darwin_amd64.go:44 wait4(824634151424, *_C_int(#604), 0, *Rusage(#479))
    syscall  syscall_bsd.go:145          Wait4(2, *WaitStatus(#605), 824661208836, *Rusage(0x2))
    os       exec_unix.go:44             (*Process).wait(*Process(#601))
    os       exec.go:132                 (*Process).Wait(...)
    exec     exec.go:507                 (*Cmd).Wait(*Cmd(#415))
    chromium allocator.go:230            (*Allocator).Allocate.func2()
396: select [Created by common.NewBaseEventEmitter @ event_emitter.go:120]
    common   event_emitter.go:130        (*BaseEventEmitter).syncAll(*, {#9, *})
1: runnable [Created by common.NewBaseEventEmitter @ event_emitter.go:120]
    common   event_emitter.go:136        (*BaseEventEmitter).syncAll(*BaseEventEmitter(#548), Context{#9, grafana/xk6-browser#577})
27: select [Created by common.(*Browser).initEvents @ browser.go:158]
    common   browser.go:160              (*Browser).initEvents.func1()
27: select [Created by common.NewConnection @ connection.go:148]
    common   connection.go:409           (*Connection).sendLoop(*)
61: select [Created by common.(*FrameSession).initEvents @ frame_session.go:206]
    common   frame_session.go:213        (*FrameSession).initEvents.func1()
39: select [Created by common.NewSession @ session.go:70]
    common   session.go:98               (*Session).readLoop(*)
27: chan receive [Created by common.NewBrowserProcess @ browser_process.go:63]
    common   browser_process.go:66       NewBrowserProcess.func1()

It looks like Page gets stuck if we close the Browser before.

@inancgumus inancgumus added the bug label Dec 8, 2021
@inancgumus inancgumus changed the title Timeout error when closing the browser before page Timeout error when closing the browser before the page Dec 8, 2021
@inancgumus inancgumus transferred this issue from grafana/xk6-browser Jan 30, 2025
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

1 participant