MiraiGo icon indicating copy to clipboard operation
MiraiGo copied to clipboard

存在一些data race

Open orzogc opened this issue 5 years ago • 1 comments

利用 Data Race Detector 发现MiraiGo存在data race:

2020/10/11 16:56:51 Mirai DEBUG: rev pkt: OnlinePush.SidTicketExpired seq: 14418
2020/10/11 16:56:55 Mirai DEBUG: rev pkt: OnlinePush.ReqPush seq: 63665
2020/10/11 16:57:04 Mirai DEBUG: rev pkt: OnlinePush.ReqPush seq: 63665
==================
WARNING: DATA RACE
Read at 0x00c0001d8ba8 by goroutine 126:
  github.com/Mrs4s/MiraiGo/client.decodeOnlinePushReqPacket.func1()
      /home/orzogc/go/pkg/mod/github.com/!mrs4s/[email protected]/client/decoders.go:700 +0x53
  github.com/Mrs4s/MiraiGo/client.decodeOnlinePushReqPacket()
      /home/orzogc/go/pkg/mod/github.com/!mrs4s/[email protected]/client/decoders.go:708 +0x794
  github.com/Mrs4s/MiraiGo/client.(*QQClient).netLoop.func1()
      /home/orzogc/go/pkg/mod/github.com/!mrs4s/[email protected]/client/client.go:1136 +0x1b7

Previous write at 0x00c0001d8ba8 by goroutine 158:
  github.com/Mrs4s/MiraiGo/client.decodeOnlinePushReqPacket()
      /home/orzogc/go/pkg/mod/github.com/!mrs4s/[email protected]/client/decoders.go:711 +0x88e
  github.com/Mrs4s/MiraiGo/client.(*QQClient).netLoop.func1()
      /home/orzogc/go/pkg/mod/github.com/!mrs4s/[email protected]/client/client.go:1136 +0x1b7

Goroutine 126 (running) created at:
  github.com/Mrs4s/MiraiGo/client.(*QQClient).netLoop()
      /home/orzogc/go/pkg/mod/github.com/!mrs4s/[email protected]/client/client.go:1121 +0x59c

Goroutine 158 (finished) created at:
  github.com/Mrs4s/MiraiGo/client.(*QQClient).netLoop()
      /home/orzogc/go/pkg/mod/github.com/!mrs4s/[email protected]/client/client.go:1121 +0x59c
==================
==================
WARNING: DATA RACE
Read at 0x00c0005f6e68 by goroutine 126:
  github.com/Mrs4s/MiraiGo/client.decodeOnlinePushReqPacket.func1()
      /home/orzogc/go/pkg/mod/github.com/!mrs4s/[email protected]/client/decoders.go:700 +0x96
  github.com/Mrs4s/MiraiGo/client.decodeOnlinePushReqPacket()
      /home/orzogc/go/pkg/mod/github.com/!mrs4s/[email protected]/client/decoders.go:708 +0x794
  github.com/Mrs4s/MiraiGo/client.(*QQClient).netLoop.func1()
      /home/orzogc/go/pkg/mod/github.com/!mrs4s/[email protected]/client/client.go:1136 +0x1b7

Previous write at 0x00c0005f6e68 by goroutine 158:
  github.com/Mrs4s/MiraiGo/client.decodeOnlinePushReqPacket()
      /home/orzogc/go/pkg/mod/github.com/!mrs4s/[email protected]/client/decoders.go:711 +0x864
  github.com/Mrs4s/MiraiGo/client.(*QQClient).netLoop.func1()
      /home/orzogc/go/pkg/mod/github.com/!mrs4s/[email protected]/client/client.go:1136 +0x1b7

Goroutine 126 (running) created at:
  github.com/Mrs4s/MiraiGo/client.(*QQClient).netLoop()
      /home/orzogc/go/pkg/mod/github.com/!mrs4s/[email protected]/client/client.go:1121 +0x59c

Goroutine 158 (finished) created at:
  github.com/Mrs4s/MiraiGo/client.(*QQClient).netLoop()
      /home/orzogc/go/pkg/mod/github.com/!mrs4s/[email protected]/client/client.go:1121 +0x59c
==================
2020/10/11 16:57:12 Mirai DEBUG: rev pkt: Heartbeat.Alive seq: 13887
2020/10/11 16:57:42 Mirai DEBUG: rev pkt: Heartbeat.Alive seq: 13888
2020/10/11 16:31:48 Mirai DEBUG: rev pkt: Heartbeat.Alive seq: 13885
2020/10/11 16:32:18 Mirai DEBUG: rev pkt: Heartbeat.Alive seq: 13886
==================
WARNING: DATA RACE
Write at 0x00c0003f05cc by goroutine 52:
  github.com/Mrs4s/MiraiGo/client.(*QQClient).doHeartbeat()
      /home/orzogc/go/pkg/mod/github.com/!mrs4s/[email protected]/client/client.go:1171 +0x79
  github.com/Mrs4s/MiraiGo/client.(*QQClient).doHeartbeat-fm()
      /home/orzogc/go/pkg/mod/github.com/!mrs4s/[email protected]/client/client.go:1160 +0x44

Previous write at 0x00c0003f05cc by goroutine 49:
  github.com/Mrs4s/MiraiGo/client.(*QQClient).doHeartbeat()
      /home/orzogc/go/pkg/mod/github.com/!mrs4s/[email protected]/client/client.go:1171 +0x79
  github.com/Mrs4s/MiraiGo/client.(*QQClient).doHeartbeat-fm()
      /home/orzogc/go/pkg/mod/github.com/!mrs4s/[email protected]/client/client.go:1160 +0x44

Goroutine 52 (running) created at:
  time.goFunc()
      /usr/lib/go/src/time/sleep.go:167 +0x51

Goroutine 49 (finished) created at:
  time.goFunc()
      /usr/lib/go/src/time/sleep.go:167 +0x51
==================
==================
WARNING: DATA RACE
Write at 0x00c0000e4f68 by main goroutine:
  github.com/Mrs4s/MiraiGo/client.(*QQClient).Disconnect()
      /home/orzogc/go/pkg/mod/github.com/!mrs4s/[email protected]/client/client.go:991 +0x8b5
  main.initMirai()
      /home/orzogc/src/go/acfunlive/mirai.go:151 +0x83e
  main.main()
      /home/orzogc/src/go/acfunlive/main.go:343 +0x115c

Previous read at 0x00c0000e4f68 by goroutine 32:
  github.com/Mrs4s/MiraiGo/client.(*QQClient).netLoop()
      /home/orzogc/go/pkg/mod/github.com/!mrs4s/[email protected]/client/client.go:1080 +0xe5

Goroutine 32 (running) created at:
  github.com/Mrs4s/MiraiGo/client.(*QQClient).Login()
      /home/orzogc/go/pkg/mod/github.com/!mrs4s/[email protected]/client/client.go:203 +0xd1
  main.initMirai()
      /home/orzogc/src/go/acfunlive/mirai.go:78 +0x2ba
  main.main()
      /home/orzogc/src/go/acfunlive/main.go:343 +0x115c
==================

orzogc avatar Oct 11 '20 09:10 orzogc

感谢提出,会逐渐处理的

Mrs4s avatar Oct 11 '20 09:10 Mrs4s