GDATASoftwareAG / vaas

Verdict-as-a-Service SDKs: Analyze files for malicious content
https://www.gdata.de/business/security-services/verdict-as-a-service
MIT License
36 stars 10 forks source link

Golang: "WARNING: DATA RACE" #614

Closed pstadermann closed 1 month ago

pstadermann commented 1 month ago

Steps to reproduce:

Fuege diesen Test in vaas_test.go hinzu und fuehre ihn mit dem -race flag aus. Bei zu schneller Internetleitung muss die Groesse vom Zufallsstring erhoeht, oder die "pingPeriod" in vaas.go verkleinert werden.

func TestVaas_ForStream_WithStreamFromLargeString(t *testing.T) {
    randomString := RandomString(200 * 1024 * 1024)
    reader := strings.NewReader(randomString)
    fixture := new(testFixture)
    VaasClient := fixture.setUp(t)
    defer fixture.tearDown(t)

    ctx, cancel := context.WithTimeout(context.Background(), 40*time.Second)
    defer cancel()
    _, err := VaasClient.ForStream(ctx, reader, reader.Size())

    if err != nil {
        t.Fatalf("unexpected error - %v", err)
    }
}

Stacktrace:

WARNING: DATA RACE
Write at 0x00c0000d8b60 by goroutine 40:
  github.com/Noooste/websocket.(*Conn).SetWriteDeadline()
      /home/k-mayer/go/pkg/mod/github.com/!noooste/websocket@v1.0.3/conn.go:788 +0x4c
  github.com/GDATASoftwareAG/vaas/golang/vaas/pkg/vaas.(*vaas).runPingTicker()
      /home/k-mayer/repos/vaas/golang/vaas/pkg/vaas/vaas.go:638 +0x322
  github.com/GDATASoftwareAG/vaas/golang/vaas/pkg/vaas.(*vaas).listenWebSocket.gowrap1()
      /home/k-mayer/repos/vaas/golang/vaas/pkg/vaas/vaas.go:668 +0x4f
 ...