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

Voice: v2: Data race when receiving audio packets and region changes #237

Closed
1lann opened this issue Jun 30, 2021 · 2 comments
Closed

Voice: v2: Data race when receiving audio packets and region changes #237

1lann opened this issue Jun 30, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@1lann
Copy link
Contributor

1lann commented Jun 30, 2021

As title says. I have a bot that is connected to voice and is actively processing audio from Discord via ReadPacket(), it appears a race condition is possible with it when the voice region changes:

==================
WARNING: DATA RACE
Write at 0x00c000020170 by goroutine 87:
  github.com/diamondburned/arikawa/v2/voice.(*Session).reconnectCtx()
      /home/jason/.go/pkg/mod/github.com/diamondburned/arikawa/v2@v2.1.0/voice/session.go:244 +0x4f8
  github.com/diamondburned/arikawa/v2/voice.(*Session).updateServer()
      /home/jason/.go/pkg/mod/github.com/diamondburned/arikawa/v2@v2.1.0/voice/session.go:124 +0x4c5
  github.com/diamondburned/arikawa/v2/voice.(*Session).updateServer-fm()
      /home/jason/.go/pkg/mod/github.com/diamondburned/arikawa/v2@v2.1.0/voice/session.go:95 +0x54
  runtime.call16()
      /home/jason/go/src/runtime/asm_amd64.s:550 +0x3d
  reflect.Value.Call()
      /home/jason/go/src/reflect/value.go:337 +0xd8
  github.com/diamondburned/arikawa/v2/utils/handler.handler.call()
      /home/jason/.go/pkg/mod/github.com/diamondburned/arikawa/v2@v2.1.0/utils/handler/handler.go:259 +0x1c4

Previous read at 0x00c000020170 by main goroutine:
  github.com/diamondburned/arikawa/v2/voice.(*Session).ReadPacket()
      /home/jason/.go/pkg/mod/github.com/diamondburned/arikawa/v2@v2.1.0/voice/session.go:377 +0x64
  github.com/tmpim/tmpvoice/commands/quotes.(*QuoteState).Worker()
      /home/jason/Douki/tmpvoice/commands/quotes/audio.go:50 +0x4f
  main.main()
      /home/jason/Douki/tmpvoice/main.go:172 +0x1396

Goroutine 87 (running) created at:
  github.com/diamondburned/arikawa/v2/utils/handler.(*Handler).Call()
      /home/jason/.go/pkg/mod/github.com/diamondburned/arikawa/v2@v2.1.0/utils/handler/handler.go:60 +0x37e
  github.com/diamondburned/arikawa/v2/internal/handleloop.(*Loop).Start.func1()
      /home/jason/.go/pkg/mod/github.com/diamondburned/arikawa/v2@v2.1.0/internal/handleloop/handleloop.go:35 +0x96
==================
@1lann 1lann changed the title Data race when connected to voice chat and region changes Voice: v2: Data race when receiving audio packets and region changes Jun 30, 2021
@diamondburned diamondburned self-assigned this Jun 30, 2021
@diamondburned
Copy link
Owner

Can you check if this is still an issue, if possible?

@diamondburned diamondburned added the bug Something isn't working label Jun 30, 2021
@1lann
Copy link
Contributor Author

1lann commented Jun 30, 2021

Yep can confirm, this is fixed.

@1lann 1lann closed this as completed Jun 30, 2021
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

2 participants