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

datarace in hotplug callback map #19

Open
bokunodev opened this issue Apr 19, 2023 · 0 comments
Open

datarace in hotplug callback map #19

bokunodev opened this issue Apr 19, 2023 · 0 comments

Comments

@bokunodev
Copy link

access to hotplugCallbackStorage is not protected by mutex.

==================
WARNING: DATA RACE
Read at 0x00c00009a330 by goroutine 7:
  runtime.mapaccess2_fast32()
      runtime/map_fast32.go:53 +0x0
  github.com/gotmc/libusb/v2.libusbHotplugCallback()
      github.com/gotmc/libusb/[email protected]/hotplug.go:203 +0xf0
  _cgoexp_0b0a3dd1d46c_libusbHotplugCallback()
      _cgo_gotypes.go:998 +0x99
  runtime.cgocallbackg1()
      runtime/cgocall.go:315 +0x2c2
  github.com/gotmc/libusb/v2.(*HotplugCallbackStorage).handleEvents.func1()
      github.com/gotmc/libusb/[email protected]/hotplug.go:176 +0x5b
  github.com/gotmc/libusb/v2.(*HotplugCallbackStorage).handleEvents()
      github.com/gotmc/libusb/[email protected]/hotplug.go:176 +0x5c
  github.com/gotmc/libusb/v2.(*Context).newHotPlugHandler.func1()
      github.com/gotmc/libusb/[email protected]/hotplug.go:65 +0x47

Previous write at 0x00c00009a330 by main goroutine:
  runtime.mapassign_fast32()
      runtime/map_fast32.go:93 +0x0
  github.com/gotmc/libusb/v2.(*Context).HotplugRegisterCallbackEvent()
      github.com/gotmc/libusb/[email protected]/hotplug.go:115 +0x147
  main.main()
      github.com/bokunodev/hid/main.go:36 +0xed

Goroutine 7 (running) created at:
  github.com/gotmc/libusb/v2.(*Context).newHotPlugHandler()
      github.com/gotmc/libusb/[email protected]/hotplug.go:65 +0x14b
  github.com/gotmc/libusb/v2.(*Context).HotplugRegisterCallbackEvent()
      github.com/gotmc/libusb/[email protected]/hotplug.go:75 +0x6b
  main.main()
      github.com/bokunodev/hid/main.go:32 +0xca
==================
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