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

Redis or MySQL cannot be used before the request #5

Open
guoxk opened this issue Oct 12, 2022 · 1 comment
Open

Redis or MySQL cannot be used before the request #5

guoxk opened this issue Oct 12, 2022 · 1 comment

Comments

@guoxk
Copy link

guoxk commented Oct 12, 2022

I used the helleim-0.9.9-py310 library and golang 1.18.1 to test. Once I used Redis or MySQL before the request, the program would crash. The following is the request code:

func main() {
	rds := connect.GetRedis()
	defer rds.Close()
	//Get a message from Redis
	str, err := redis.String(rds.Do("rpop",“test_key”))
	if err != nil {
		log.Println(err)
		return
	}
	log.Println(str)
	apiKey := "my_Key"
	helheimClient, err := helheim_go.ProvideClient(apiKey, false, true, nil)
	if err != nil {
		log.Println(err)
		return
	}
	// check possible options in the python examples
	options := helheim_go.CreateSessionOptions{
		Browser: helheim_go.BrowserOptions{
			Browser:  "chrome",
			Mobile:   false,
			Platform: "windows",
		},
		Captcha: helheim_go.CaptchaOptions{
			Provider: "vanaheim",
		},
	}
	session, err := helheimClient.NewSession(options)
	if err != nil {
		log.Println(err)
		return
	}
	reqOpts := helheim_go.RequestOptions{
		Method:  http.MethodGet,
		Url:     "https://www.genx.co.nz/iuam/",
		Options: make(map[string]string),
	}
	resp, err := session.Request(reqOpts)
	if err != nil {
		log.Println(err)
		return
	}
	log.Println(resp.Response.Body)
}

Error message:
fatal: morestack on g0
SIGTRAP: trace trap
PC=0x4065702 m=7 sigcode=1
signal arrived during cgo execution

goroutine 1 [syscall]:
runtime.cgocall(0x4393c10, 0xc00012dc70)
/usr/local/go/src/runtime/cgocall.go:157 +0x5c fp=0xc00012dc48 sp=0xc00012dc10 pc=0x400715c
github.com/bogdanfinn/helheim-go._Cfunc_auth(0xc504130, 0x0)
_cgo_gotypes.go:71 +0x4d fp=0xc00012dc70 sp=0xc00012dc48 pc=0x425222d
github.com/bogdanfinn/helheim-go.(*helheim).Auth(0xc000290040)
/Users/gxk/go/pkg/mod/github.com/bogdanfinn/[email protected]/helheim.go:105 +0x105 fp=0xc00012dd30 sp=0xc00012dc70 pc=0x4252f25
github.com/bogdanfinn/helheim-go.newHelheim({0x4443837, 0x24}, 0x0, 0x1, {0x44dbde8?, 0x473ddd8?})
/Users/gxk/go/pkg/mod/github.com/bogdanfinn/[email protected]/helheim.go:74 +0xcd fp=0xc00012dd88 sp=0xc00012dd30 pc=0x4252d0d
github.com/bogdanfinn/helheim-go.NewClient({0x4443837?, 0xc00007e0d0?}, 0x60?, 0xe4?, {0x0?, 0x0?})
/Users/gxk/go/pkg/mod/github.com/bogdanfinn/[email protected]/client.go:51 +0x4f fp=0xc00012ddf8 sp=0xc00012dd88 pc=0x424f4af
github.com/bogdanfinn/helheim-go.ProvideClient({0x4443837?, 0x52?}, 0x0?, 0x0?, {0x0?, 0x0?})
/Users/gxk/go/pkg/mod/github.com/bogdanfinn/[email protected]/client.go:35 +0x118 fp=0xc00012de78 sp=0xc00012ddf8 pc=0x424f298
main.main()
/Users/gxk/project/go-collect-test/main.go:54 +0x192 fp=0xc00012df80 sp=0xc00012de78 pc=0x43938b2
runtime.main()
/usr/local/go/src/runtime/proc.go:250 +0x212 fp=0xc00012dfe0 sp=0xc00012df80 pc=0x4038f32
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1571 +0x1 fp=0xc00012dfe8 sp=0xc00012dfe0 pc=0x4065881

goroutine 6 [select]:
database/sql.(*DB).connectionOpener(0xc000211450, {0x44dbb80, 0xc000212f40})
/usr/local/go/src/database/sql/sql.go:1226 +0x8d
created by database/sql.OpenDB
/usr/local/go/src/database/sql/sql.go:794 +0x18d

goroutine 18 [select]:
github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher.func1()
/Users/gxk/go/pkg/mod/github.com/go-sql-driver/[email protected]/connection.go:614 +0xaa
created by github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher
/Users/gxk/go/pkg/mod/github.com/go-sql-driver/[email protected]/connection.go:611 +0xfe

goroutine 34 [select]:
database/sql.(*DB).connectionCleaner(0xc000211450, 0xc000212f40?)
/usr/local/go/src/database/sql/sql.go:1069 +0xa7
created by database/sql.(*DB).startCleanerLocked
/usr/local/go/src/database/sql/sql.go:1056 +0xff

rax 0x17
rbx 0x7000041f2cd8
rcx 0xc00017fb00
rdx 0x0
rdi 0x2
rsi 0x7000041f2c80
rbp 0x316f0790
rsp 0x7000041f2d28
r8 0xc00017fb00
r9 0xc000000000000000
r10 0x7000041f2cd8
r11 0x202
r12 0x7000041f4f10
r13 0x31759290
r14 0xc000117d40
r15 0x7000041f2d40
rip 0x4065702
rflags 0x206
cs 0x2b
fs 0x0
gs 0x0

@bogdanfinn
Copy link
Owner

@guoxk
you are right. i can reproduce.

the interesting part is, when you move the helheim client initialization before the redis one it should work.

this part:

apiKey := "my_Key"
	helheimClient, err := helheim_go.ProvideClient(apiKey, false, true, nil)
	if err != nil {
		log.Println(err)
		return
	}

will investigate why this happens

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants