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

Systray App data race #1186

Closed
ersonp opened this issue May 11, 2022 · 2 comments
Closed

Systray App data race #1186

ersonp opened this issue May 11, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@ersonp
Copy link
Contributor

ersonp commented May 11, 2022

Describe the bug
Datarace when starting systray.

Environment information:

  • OS: e.g. Linux
  • Platform: Linux 5.13.0-40-generic x86_64

Steps to Reproduce
Steps to reproduce the behavior:

  1. Change in makefile
    host-apps-systray: ## Build app
        CGO_ENABLED=1 ${OPTS} go build ${BUILD_OPTS} -race -o ./apps/ ./cmd/apps/skychat
        CGO_ENABLED=1 ${OPTS} go build ${BUILD_OPTS} -race -o ./apps/ ./cmd/apps/skysocks
        CGO_ENABLED=1 ${OPTS} go build ${BUILD_OPTS} -race -o ./apps/  ./cmd/apps/skysocks-client
        CGO_ENABLED=1 ${OPTS} go build ${BUILD_OPTS} -race -tags systray -o ./apps/ ./cmd/apps/vpn-server
        CGO_ENABLED=1 ${OPTS} go build ${BUILD_OPTS} -race -tags systray -o ./apps/ ./cmd/apps/vpn-client
    
    bin-systray: ## Build `skywire-visor`, `skywire-cli`
        CGO_ENABLED=1 ${OPTS} go build ${BUILD_OPTS} -tags systray -race -o ./ ./cmd/skywire-visor
        CGO_ENABLED=1 ${OPTS} go build ${BUILD_OPTS} -tags systray -race -o ./ ./cmd/skywire-cli
        CGO_ENABLED=1 ${OPTS} go build ${BUILD_OPTS} -race -o ./ ./cmd/setup-node
    
  2. Build make build-systray
  3. Start visor ./skywire-visor -c skywire-config.json
  4. See error

Actual behavior

48538 - 200 1607B in 3.311481ms
==================
WARNING: DATA RACE
Read at 0x00c0000336b0 by goroutine 178:
  runtime.mapaccess2_fast32()
      /usr/local/go/src/runtime/map_fast32.go:52 +0x0
  github.com/skycoin/systray.(*tray).Event()
      /home/erson/Workspace/Go/skywire/vendor/github.com/skycoin/systray/systray_menu_unix.go:56 +0x88
  github.com/skycoin/systray/internal/generated/menu.Dbusmenuer.Event-fm()
      /home/erson/Workspace/Go/skywire/vendor/github.com/skycoin/systray/internal/generated/menu/dbus_menu.go:198 +0xdc
  runtime.call64()
      /usr/local/go/src/runtime/asm_amd64.s:627 +0x48
  reflect.Value.Call()
      /usr/local/go/src/reflect/value.go:339 +0xd7
  github.com/godbus/dbus/v5.exportedMethod.Call()
      /home/erson/Workspace/Go/skywire/vendor/github.com/godbus/dbus/v5/default_handler.go:128 +0x356
  github.com/godbus/dbus/v5.(*exportedMethod).Call()
      <autogenerated>:1 +0x8f
  github.com/godbus/dbus/v5.(*Conn).handleCall()
      /home/erson/Workspace/Go/skywire/vendor/github.com/godbus/dbus/v5/export.go:193 +0x70e
  github.com/godbus/dbus/v5.(*Conn).inWorker·dwrap·5()
      /home/erson/Workspace/Go/skywire/vendor/github.com/godbus/dbus/v5/conn.go:435 +0x47

Previous write at 0x00c0000336b0 by goroutine 11:
  ??()
      -:0 +0xffffffffffffffff
  reflect.Value.Interface()
      /usr/local/go/src/reflect/value.go:1351 +0xc47
  github.com/godbus/dbus/v5.(*encoder).encode()
      /home/erson/Workspace/Go/skywire/vendor/github.com/godbus/dbus/v5/encoder.go:192 +0xc48
  github.com/godbus/dbus/v5.(*encoder).encode()
      /home/erson/Workspace/Go/skywire/vendor/github.com/godbus/dbus/v5/encoder.go:199 +0x2a7c
  github.com/godbus/dbus/v5.(*encoder).encode()
      /home/erson/Workspace/Go/skywire/vendor/github.com/godbus/dbus/v5/encoder.go:163 +0x2ac6
  github.com/godbus/dbus/v5.(*encoder).Encode()
      /home/erson/Workspace/Go/skywire/vendor/github.com/godbus/dbus/v5/encoder.go:75 +0x2ab
  github.com/godbus/dbus/v5.(*Message).EncodeToWithFDs()
      /home/erson/Workspace/Go/skywire/vendor/github.com/godbus/dbus/v5/message.go:263 +0x806
  github.com/godbus/dbus/v5.(*Message).EncodeTo()
      /home/erson/Workspace/Go/skywire/vendor/github.com/godbus/dbus/v5/message.go:282 +0x4be
  github.com/godbus/dbus/v5.(*unixTransport).SendMessage()
      /home/erson/Workspace/Go/skywire/vendor/github.com/godbus/dbus/v5/transport_unix.go:203 +0x489
  github.com/godbus/dbus/v5.(*outputHandler).sendAndIfClosed()
      /home/erson/Workspace/Go/skywire/vendor/github.com/godbus/dbus/v5/conn.go:807 +0x1d0
  github.com/godbus/dbus/v5.(*Conn).sendMessageAndIfClosed()
      /home/erson/Workspace/Go/skywire/vendor/github.com/godbus/dbus/v5/conn.go:495 +0x10a
  github.com/godbus/dbus/v5.(*Conn).Emit()
      /home/erson/Workspace/Go/skywire/vendor/github.com/godbus/dbus/v5/export.go:245 +0x68c
  github.com/skycoin/systray/internal/generated/menu.Emit()
      /home/erson/Workspace/Go/skywire/vendor/github.com/skycoin/systray/internal/generated/menu/dbus_menu.go:88 +0x129
  github.com/skycoin/systray.refresh()
      /home/erson/Workspace/Go/skywire/vendor/github.com/skycoin/systray/systray_menu_unix.go:242 +0x371
  github.com/skycoin/systray.hideMenuItem()
      /home/erson/Workspace/Go/skywire/vendor/github.com/skycoin/systray/systray_menu_unix.go:220 +0x184
  github.com/skycoin/systray.(*MenuItem).Hide()
      /home/erson/Workspace/Go/skywire/vendor/github.com/skycoin/systray/systray.go:195 +0xdd
  github.com/skycoin/skywire/internal/gui.initAdvancedButton()
      /home/erson/Workspace/Go/skywire/internal/gui/gui.go:139 +0xc6
  github.com/skycoin/skywire/internal/gui.GetOnGUIReady.func3()
      /home/erson/Workspace/Go/skywire/internal/gui/gui.go:93 +0xb2
  github.com/skycoin/systray.Register.func2()
      /home/erson/Workspace/Go/skywire/vendor/github.com/skycoin/systray/systray.go:99 +0x45

Goroutine 178 (running) created at:
  github.com/godbus/dbus/v5.(*Conn).inWorker()
      /home/erson/Workspace/Go/skywire/vendor/github.com/godbus/dbus/v5/conn.go:435 +0x476
  github.com/godbus/dbus/v5.(*Conn).Auth·dwrap·1()
      /home/erson/Workspace/Go/skywire/vendor/github.com/godbus/dbus/v5/auth.go:118 +0x39
==================
[2022-05-11T13:11:23+05:30] INFO [visor_rpc:CLI]: Request processed. _elapsed="34.655µs" _method="StopApp" _received="1:11PM" error="app not running" input=0xc003a16f70
[2022-05-11T13:11:23+05:30] INFO [visor]: Changing vpn-client PK to "037695281fc8b59a94b15abe4093845c2ac67f43a59c5d9bcd6e60a449c7342dd2"
[2022-05-11T13:11:23+05:30] INFO [visor:config]: Flushing config to file. config_version="v0.6.0-330-g1081dbad" filepath="skywire-config.json"
[2022-05-11T13:11:23+05:30] INFO [visor]: Updated vpn-client PK
[2022-05-11T13:11:23+05:30] INFO [visor_rpc:CLI]: Request processed. _elapsed="13.741839ms" _method="SetAppPK" _received="1:11PM" input=&{AppName:vpn-client PK:037695281fc8b59a94b15abe4093845c2ac67f43a59c5d9bcd6e60a449c7342dd2}
==================
WARNING: DATA RACE
Write at 0x000001d2f9a0 by goroutine 102:
  github.com/skycoin/skywire/internal/gui.serversBtn()
      /home/erson/Workspace/Go/skywire/internal/gui/gui.go:263 +0x424
  github.com/skycoin/skywire/internal/gui.initVpnClientBtn·dwrap·5()
      /home/erson/Workspace/Go/skywire/internal/gui/gui.go:200 +0x8b

Previous read at 0x000001d2f9a0 by goroutine 127:
  github.com/skycoin/skywire/internal/gui.vpnStatusBtn()
      /home/erson/Workspace/Go/skywire/internal/gui/gui.go:221 +0x286
  github.com/skycoin/skywire/internal/gui.initVpnClientBtn·dwrap·4()
      /home/erson/Workspace/Go/skywire/internal/gui/gui.go:191 +0x58

Goroutine 102 (running) created at:
  github.com/skycoin/skywire/internal/gui.initVpnClientBtn()
      /home/erson/Workspace/Go/skywire/internal/gui/gui.go:200 +0x5fd
  github.com/skycoin/skywire/internal/gui.GetOnGUIReady.func3()
      /home/erson/Workspace/Go/skywire/internal/gui/gui.go:92 +0xa8
  github.com/skycoin/systray.Register.func2()
      /home/erson/Workspace/Go/skywire/vendor/github.com/skycoin/systray/systray.go:99 +0x45

Goroutine 127 (running) created at:
  github.com/skycoin/skywire/internal/gui.initVpnClientBtn()
      /home/erson/Workspace/Go/skywire/internal/gui/gui.go:191 +0x355
  github.com/skycoin/skywire/internal/gui.GetOnGUIReady.func3()
      /home/erson/Workspace/Go/skywire/internal/gui/gui.go:92 +0xa8
  github.com/skycoin/systray.Register.func2()
      /home/erson/Workspace/Go/skywire/vendor/github.com/skycoin/systray/systray.go:99 +0x45
==================
@ersonp ersonp added the bug Something isn't working label May 11, 2022
@mrpalide
Copy link
Contributor

Seems this data race problem related to systray lib itself. fyne-io/systray#12 (comment)

@jdknives jdknives changed the title Datarace in systray Systray App data race May 27, 2022
@jdknives
Copy link
Member

Superseded by #1272

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants