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

Threadsafe + Autoreconnect is not thread safe #149

Open
MassiveBox opened this issue Sep 30, 2020 · 0 comments
Open

Threadsafe + Autoreconnect is not thread safe #149

MassiveBox opened this issue Sep 30, 2020 · 0 comments

Comments

@MassiveBox
Copy link

==================
WARNING: DATA RACE
Read at 0x00c000158720 by goroutine 23:
  github.com/ziutek/mymysql/thrsafe.(*Conn).pinger()
      /root/pkg/mod/github.com/ziutek/[email protected]/thrsafe/thrsafe.go:76 +0x1a1

Previous write at 0x00c000158720 by goroutine 32:
  [failed to restore the stack]

Goroutine 23 (running) created at:
  github.com/ziutek/mymysql/thrsafe.(*Conn).Connect()
      /root/pkg/mod/github.com/ziutek/[email protected]/thrsafe/thrsafe.go:92 +0x118
  github.com/ziutek/mymysql/autorc.(*Conn).connectIfNotConnected()
      /root/pkg/mod/github.com/ziutek/[email protected]/autorc/autorecon.go:93 +0x96
  github.com/ziutek/mymysql/autorc.(*Conn).Query()
      /root/pkg/mod/github.com/ziutek/[email protected]/autorc/autorecon.go:134 +0x5b
  main.reopenSessions()
      /dir/whatsapp_auth.go:71 +0x76

On file dir/whatsapp_auth.go line 71 I have:
rows, _, _ := db.Query("SELECT user_id FROM wtg WHERE session != ''")
What am I missing?

@MassiveBox MassiveBox changed the title Threadsafe + Autortc is not thread safe Threadsafe + Autoreconnect is not thread safe Sep 30, 2020
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

1 participant