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

panic when use gin and rod, Failed to get the debug url and Opening in existing browser session,detail see following #665

Closed
passerbyo opened this issue Jul 24, 2022 · 10 comments
Labels
question Questions related to rod

Comments

@passerbyo
Copy link

passerbyo commented Jul 24, 2022

Rod Version: v0.108.1

The code to demonstrate your question

i got a bug. here is my go code

i use command curl http://127.0.0.1/run to run code.

package main

import (
  "github.com/gin-gonic/gin"
  "github.com/rakyll/statik/fs"
  "github.com/go-rod/rod"
  "github.com/go-rod/rod/lib/launcher"
  "github.com/go-rod/stealth"
)

func rodhandle() {
  u := launcher.New().
  Headless(false).
  MustLaunch()
  browser := rod.New().ControlURL(u).MustConnect().Trace(true).MustIncognito()
  defer browser.MustClose()
  page := stealth.MustPage(browser)
  defer page.MustClose()
  page.MustNavigate("https://google.com/")
  page.MustWaitLoad()
}

func main(){
  r := gin.Default()
  r.GET("/run",func(c *gin.Context){
    go rod.rodhandle()
  })
  r.Run()
}

second time to access /run url will see and panic

What you got

when i run my code with go run main.go and curl http:127.0.0.1:8080/run at second time, the shell shows my following log,
panic: [launcher] Failed to get the debug url: libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null) Opening in existing browser session. [0722/023228.007212:ERROR:nacl_helper_linux.cc(315)] NaCl helper process running without a sandbox! Most likely you need to configure your SUID sandbox correctly

What you expected to see

when i curl http:127.0.0.1:8080/run and xode runs normally

What have you tried to solve the question

I'm relatively new to Go, I haven't tried to hack Rod, I have no clue on where to look

@passerbyo passerbyo added the question Questions related to rod label Jul 24, 2022
@passerbyo
Copy link
Author

passerbyo commented Jul 24, 2022

#664 i try my best to follow #332 and follow the second rule of #332

If the long code block is not syntax highlighted with markdown

i dont know what the code block is not syntax highlighted with ... means, i just follow others issue template. and i try to use two * to surround my long code,but it has no effect

@ysmood
Copy link
Member

ysmood commented Jul 25, 2022

Please check the first rule of #322

@ysmood ysmood closed this as not planned Won't fix, can't repro, duplicate, stale Jul 25, 2022
@passerbyo
Copy link
Author

this issue follows all rules of #322 , please check @ysmood

@ysmood ysmood reopened this Jul 25, 2022
@ysmood
Copy link
Member

ysmood commented Jul 25, 2022

MustIncognito creates an incognito browser, which is not the origin browser anymore, close it doesn't close the origin browser object. Please read its doc carefully.

You should code like this:

func rodhandle() {
  u := launcher.New().
  Headless(false).
  MustLaunch()
  b := rod.New().ControlURL(u).MustConnect().Trace(true)
  defer b.MustClose()
  browser := b.MustIncognito()
  page := stealth.MustPage(browser)
  defer page.MustClose()
  page.MustNavigate("https://google.com/")
  page.MustWaitLoad()
}

@tyron
Copy link
Contributor

tyron commented Jul 25, 2022

@passerbyo as a general rule for being polite, please don't randomly mention people in your issues. I have no real involvement with the project and I'm not even sure where you got my username from. Thanks

@ysmood
Copy link
Member

ysmood commented Jul 25, 2022

@passerbyo The #322 says

ping @go-rod/everyone

@go-rod/everyone already means everyone, you don't have to ping everyone again. Please help to keep github a clean place.

@passerbyo
Copy link
Author

passerbyo commented Jul 25, 2022

@passerbyo The #322 says

ping @go-rod/everyone

@go-rod/everyone already means everyone, you don't have to ping everyone again. Please help to keep github a clean place.

ok,i got it.thanks very much.

@passerbyo
Copy link
Author

@passerbyo as a general rule for being polite, please don't randomly mention people in your issues. I have no real involvement with the project and I'm not even sure where you got my username from. Thanks

i am very sorry for the convenience i caused for you.Maybe I accidentally clicked

@ysmood ysmood closed this as completed Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions related to rod
Projects
None yet
Development

No branches or pull requests

3 participants