Skip to content

Conversation

@gyuho
Copy link
Member

@gyuho gyuho commented Sep 17, 2025

Fix

=== NAME  TestStartWriterAndReader
    session_test.go:244: Context still active before Stop()
==================
WARNING: DATA RACE
Write at 0x00c00014c4e0 by goroutine 16497:
  runtime.closechan()
      /opt/hostedtoolcache/go/1.24.7/x64/src/runtime/chan.go:414 +0x0
  github.com/leptonai/gpud/pkg/session.(*Session).Stop()
      /home/runner/work/gpud/gpud/pkg/session/session.go:659 +0x1a4
  github.com/leptonai/gpud/pkg/session.TestStartWriterAndReader()
      /home/runner/work/gpud/gpud/pkg/session/session_test.go:247 +0xf11
  testing.tRunner()
      /opt/hostedtoolcache/go/1.24.7/x64/src/testing/testing.go:1792 +0x225
  testing.(*T).Run.gowrap1()
      /opt/hostedtoolcache/go/1.24.7/x64/src/testing/testing.go:1851 +0x44

Previous read at 0x00c00014c4e0 by goroutine 16506:
  runtime.chansend()
      /opt/hostedtoolcache/go/1.24.7/x64/src/runtime/chan.go:176 +0x0
  github.com/leptonai/gpud/pkg/session.(*Session).tryWriteToReader()
      /home/runner/work/gpud/gpud/pkg/session/session.go:608 +0x6a4
  github.com/leptonai/gpud/pkg/session.(*Session).processReaderResponse()
      /home/runner/work/gpud/gpud/pkg/session/session.go:587 +0x37b
  github.com/leptonai/gpud/pkg/session.(*Session).startReader()
      /home/runner/work/gpud/gpud/pkg/session/session.go:539 +0xac4
  github.com/leptonai/gpud/pkg/session.(*Session).startReader-fm()
      <autogenerated>:1 +0x64
  github.com/leptonai/gpud/pkg/session.(*Session).keepAlive.gowrap1()
      /home/runner/work/gpud/gpud/pkg/session/session.go:367 +0x6e

Goroutine 16497 (running) created at:
  testing.(*T).Run()
      /opt/hostedtoolcache/go/1.24.7/x64/src/testing/testing.go:1851 +0x8f2
  testing.runTests.func1()
      /opt/hostedtoolcache/go/1.24.7/x64/src/testing/testing.go:2279 +0x85
  testing.tRunner()
      /opt/hostedtoolcache/go/1.24.7/x64/src/testing/testing.go:1792 +0x225
  testing.runTests()
      /opt/hostedtoolcache/go/1.24.7/x64/src/testing/testing.go:2277 +0x96c
  testing.(*M).Run()
      /opt/hostedtoolcache/go/1.24.7/x64/src/testing/testing.go:2142 +0xeea
  main.main()
      _testmain.go:155 +0x164

Goroutine 16506 (finished) created at:
  github.com/leptonai/gpud/pkg/session.(*Session).keepAlive()
      /home/runner/work/gpud/gpud/pkg/session/session.go:367 +0x80a
  github.com/leptonai/gpud/pkg/session.TestStartWriterAndReader.gowrap2()
      /home/runner/work/gpud/gpud/pkg/session/session_test.go:197 +0x33
==================
    testing.go:1490: race detected during execution of test
--- FAIL: TestStartWriterAndReader (0.81s)

Signed-off-by: Gyuho Lee gyuhol@nvidia.com

Fix

```
=== NAME  TestStartWriterAndReader
    session_test.go:244: Context still active before Stop()
==================
WARNING: DATA RACE
Write at 0x00c00014c4e0 by goroutine 16497:
  runtime.closechan()
      /opt/hostedtoolcache/go/1.24.7/x64/src/runtime/chan.go:414 +0x0
  github.com/leptonai/gpud/pkg/session.(*Session).Stop()
      /home/runner/work/gpud/gpud/pkg/session/session.go:659 +0x1a4
  github.com/leptonai/gpud/pkg/session.TestStartWriterAndReader()
      /home/runner/work/gpud/gpud/pkg/session/session_test.go:247 +0xf11
  testing.tRunner()
      /opt/hostedtoolcache/go/1.24.7/x64/src/testing/testing.go:1792 +0x225
  testing.(*T).Run.gowrap1()
      /opt/hostedtoolcache/go/1.24.7/x64/src/testing/testing.go:1851 +0x44

Previous read at 0x00c00014c4e0 by goroutine 16506:
  runtime.chansend()
      /opt/hostedtoolcache/go/1.24.7/x64/src/runtime/chan.go:176 +0x0
  github.com/leptonai/gpud/pkg/session.(*Session).tryWriteToReader()
      /home/runner/work/gpud/gpud/pkg/session/session.go:608 +0x6a4
  github.com/leptonai/gpud/pkg/session.(*Session).processReaderResponse()
      /home/runner/work/gpud/gpud/pkg/session/session.go:587 +0x37b
  github.com/leptonai/gpud/pkg/session.(*Session).startReader()
      /home/runner/work/gpud/gpud/pkg/session/session.go:539 +0xac4
  github.com/leptonai/gpud/pkg/session.(*Session).startReader-fm()
      <autogenerated>:1 +0x64
  github.com/leptonai/gpud/pkg/session.(*Session).keepAlive.gowrap1()
      /home/runner/work/gpud/gpud/pkg/session/session.go:367 +0x6e

Goroutine 16497 (running) created at:
  testing.(*T).Run()
      /opt/hostedtoolcache/go/1.24.7/x64/src/testing/testing.go:1851 +0x8f2
  testing.runTests.func1()
      /opt/hostedtoolcache/go/1.24.7/x64/src/testing/testing.go:2279 +0x85
  testing.tRunner()
      /opt/hostedtoolcache/go/1.24.7/x64/src/testing/testing.go:1792 +0x225
  testing.runTests()
      /opt/hostedtoolcache/go/1.24.7/x64/src/testing/testing.go:2277 +0x96c
  testing.(*M).Run()
      /opt/hostedtoolcache/go/1.24.7/x64/src/testing/testing.go:2142 +0xeea
  main.main()
      _testmain.go:155 +0x164

Goroutine 16506 (finished) created at:
  github.com/leptonai/gpud/pkg/session.(*Session).keepAlive()
      /home/runner/work/gpud/gpud/pkg/session/session.go:367 +0x80a
  github.com/leptonai/gpud/pkg/session.TestStartWriterAndReader.gowrap2()
      /home/runner/work/gpud/gpud/pkg/session/session_test.go:197 +0x33
==================
    testing.go:1490: race detected during execution of test
--- FAIL: TestStartWriterAndReader (0.81s)
```

Signed-off-by: Gyuho Lee <gyuhol@nvidia.com>
@gyuho gyuho added this to the v0.8.0 milestone Sep 17, 2025
@gyuho gyuho self-assigned this Sep 17, 2025
@codecov
Copy link

codecov bot commented Sep 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.70%. Comparing base (fc398aa) to head (c183187).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1077      +/-   ##
==========================================
+ Coverage   67.65%   67.70%   +0.04%     
==========================================
  Files         313      313              
  Lines       26081    26081              
==========================================
+ Hits        17644    17657      +13     
+ Misses       7558     7547      -11     
+ Partials      879      877       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gyuho
Copy link
Member Author

gyuho commented Sep 23, 2025

Closing in favor of #1082

@gyuho gyuho closed this Sep 23, 2025
@gyuho gyuho deleted the fix-racey-tests branch September 23, 2025 13:42
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

Successfully merging this pull request may close these issues.

1 participant