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

fix: git daemon listens only when starting it #607

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

jaw
Copy link
Contributor

@jaw jaw commented Nov 21, 2024

This was inconsistent with the other servers.

This was inconsistent with the other servers.
@aymanbagabas aymanbagabas merged commit 3aa71e0 into charmbracelet:main Dec 4, 2024
8 of 10 checks passed
@aymanbagabas
Copy link
Member

Thank you @jaw!

@aymanbagabas
Copy link
Member

Seems like there's a race condition with this change:

==================
WARNING: DATA RACE
Read at 0x00c00038c290 by main goroutine:
  github.com/charmbracelet/soft-serve/pkg/daemon.(*GitDaemon).Close()
      /home/runner/work/soft-serve/soft-serve/pkg/daemon/daemon.go:309 +0x78
  github.com/charmbracelet/soft-serve/pkg/daemon.TestMain()
      /home/runner/work/soft-serve/soft-serve/pkg/daemon/daemon_test.go:72 +0x8e7
  main.main()
      _testmain.go:49 +0x171

Previous write at 0x00c00038c290 by goroutine 25:
  github.com/charmbracelet/soft-serve/pkg/daemon.(*GitDaemon).Start()
      /home/runner/work/soft-serve/soft-serve/pkg/daemon/daemon.go:81 +0xa6
  github.com/charmbracelet/soft-serve/pkg/daemon.TestMain.func1()
      /home/runner/work/soft-serve/soft-serve/pkg/daemon/daemon_test.go:62 +0x2e

Goroutine 25 (running) created at:
  github.com/charmbracelet/soft-serve/pkg/daemon.TestMain()
      /home/runner/work/soft-serve/soft-serve/pkg/daemon/daemon_test.go:61 +0x86a
  main.main()
      _testmain.go:49 +0x171
==================
==================
WARNING: DATA RACE
Read at 0x00c0001e2b40 by main goroutine:
  net.(*TCPListener).ok()
      /opt/hostedtoolcache/go/1.23.3/x64/src/net/tcpsock_posix.go:156 +0x33
  net.(*TCPListener).Close()
      /opt/hostedtoolcache/go/1.23.3/x64/src/net/tcpsock.go:382 +0x3d
  github.com/charmbracelet/soft-serve/pkg/daemon.(*GitDaemon).Close()
      /home/runner/work/soft-serve/soft-serve/pkg/daemon/daemon.go:309 +0x8b
  github.com/charmbracelet/soft-serve/pkg/daemon.TestMain()
      /home/runner/work/soft-serve/soft-serve/pkg/daemon/daemon_test.go:72 +0x8e7
  main.main()
      _testmain.go:49 +0x171

Previous write at 0x00c0001e2b40 by goroutine 25:
  net.(*sysListener).listenTCPProto()
      /opt/hostedtoolcache/go/1.23.3/x64/src/net/tcpsock_posix.go:193 +0x16b
  net.(*sysListener).listenTCP()
      /opt/hostedtoolcache/go/1.23.3/x64/src/net/tcpsock_posix.go:179 +0x4b7
  net.(*ListenConfig).Listen()
      /opt/hostedtoolcache/go/1.23.3/x64/src/net/dial.go:765 +0x490
  net.Listen()
      /opt/hostedtoolcache/go/1.23.3/x64/src/net/dial.go:839 +0x96
  github.com/charmbracelet/soft-serve/pkg/daemon.(*GitDaemon).Start()
      /home/runner/work/soft-serve/soft-serve/pkg/daemon/daemon.go:77 +0x74
  github.com/charmbracelet/soft-serve/pkg/daemon.TestMain.func1()
      /home/runner/work/soft-serve/soft-serve/pkg/daemon/daemon_test.go:62 +0x2e

Goroutine 25 (running) created at:
  github.com/charmbracelet/soft-serve/pkg/daemon.TestMain()
      /home/runner/work/soft-serve/soft-serve/pkg/daemon/daemon_test.go:61 +0x86a
  main.main()
      _testmain.go:49 +0x171
==================
Found 2 data race(s)
FAIL	github.com/charmbracelet/soft-serve/pkg/daemon	1.068s
ok  	github.com/charmbracelet/soft-serve/pkg/db	1.012s [no tests to run]
ok  	github.com/charmbracelet/soft-serve/pkg/db/migrate	1.012s [no tests to run]
FAIL

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.

2 participants