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

net/nat.go has data race problem #3139

Open
wlynxg opened this issue Jan 16, 2025 · 0 comments · May be fixed by #3140
Open

net/nat.go has data race problem #3139

wlynxg opened this issue Jan 16, 2025 · 0 comments · May be fixed by #3140

Comments

@wlynxg
Copy link
Contributor

wlynxg commented Jan 16, 2025

Version Information
github.com/libp2p/go-libp2p v0.37.2
==================
WARNING: DATA RACE
Write at 0x00c000022a18 by goroutine 1286:
  github.com/libp2p/go-libp2p/p2p/net/nat.(*NAT).background()
      /root/fsp2p/pkgs/go-libp2p@v0.37.2/p2p/net/nat/nat.go:205 +0x684
  github.com/libp2p/go-libp2p/p2p/net/nat.DiscoverNAT.func1()
      /root/fsp2p/pkgs/go-libp2p@v0.37.2/p2p/net/nat/nat.go:67 +0x84

Previous read at 0x00c000022a18 by goroutine 132:
  github.com/libp2p/go-libp2p/p2p/net/nat.(*NAT).GetMapping()
      /root/fsp2p/pkgs/go-libp2p@v0.37.2/p2p/net/nat/nat.go:113 +0x1fe
  github.com/libp2p/go-libp2p/p2p/host/basic.(*natManager).GetMapping()
      /root/fsp2p/pkgs/go-libp2p@v0.37.2/p2p/host/basic/natmgr.go:269 +0x3d2
  github.com/libp2p/go-libp2p/p2p/host/basic.(*BasicHost).AllAddrs()
      /root/fsp2p/pkgs/go-libp2p@v0.37.2/p2p/host/basic/basic_host.go:902 +0x695
  github.com/libp2p/go-libp2p/config.(*Config).addAutoNAT.func1()
      /root/fsp2p/pkgs/go-libp2p@v0.37.2/config/config.go:571 +0x2e
  github.com/libp2p/go-libp2p/p2p/host/autonat.(*AmbientAutoNAT).checkAddrs()
      /root/fsp2p/pkgs/go-libp2p@v0.37.2/p2p/host/autonat/autonat.go:247 +0x77
  github.com/libp2p/go-libp2p/p2p/host/autonat.(*AmbientAutoNAT).background()
      /root/fsp2p/pkgs/go-libp2p@v0.37.2/p2p/host/autonat/autonat.go:233 +0xc9d
  github.com/libp2p/go-libp2p/p2p/host/autonat.New.gowrap1()
      /root/fsp2p/pkgs/go-libp2p@v0.37.2/p2p/host/autonat/autonat.go:138 +0x33

Goroutine 1286 (running) created at:
  github.com/libp2p/go-libp2p/p2p/net/nat.DiscoverNAT()
      /root/fsp2p/pkgs/go-libp2p@v0.37.2/p2p/net/nat/nat.go:65 +0x574
  github.com/libp2p/go-libp2p/p2p/host/basic.init.func2()
      /root/fsp2p/pkgs/go-libp2p@v0.37.2/p2p/host/basic/natmgr.go:46 +0x33
  github.com/libp2p/go-libp2p/p2p/host/basic.(*natManager).background()
      /root/fsp2p/pkgs/go-libp2p@v0.37.2/p2p/host/basic/natmgr.go:110 +0x195
  github.com/libp2p/go-libp2p/p2p/host/basic.newNATManager.gowrap1()
      /root/fsp2p/pkgs/go-libp2p@v0.37.2/p2p/host/basic/natmgr.go:78 +0x4f

Goroutine 132 (running) created at:
  github.com/libp2p/go-libp2p/p2p/host/autonat.New()
      /root/fsp2p/pkgs/go-libp2p@v0.37.2/p2p/host/autonat/autonat.go:138 +0xe6a
  github.com/libp2p/go-libp2p/config.(*Config).addAutoNAT()
      /root/fsp2p/pkgs/go-libp2p@v0.37.2/config/config.go:662 +0x18c6
  github.com/libp2p/go-libp2p/config.(*Config).NewNode()
      /root/fsp2p/pkgs/go-libp2p@v0.37.2/config/config.go:552 +0x1c52
  github.com/libp2p/go-libp2p.NewWithoutDefaults()
      /root/fsp2p/pkgs/go-libp2p@v0.37.2/libp2p.go:67 +0xe4
  github.com/libp2p/go-libp2p.New()
      /root/fsp2p/pkgs/go-libp2p@v0.37.2/libp2p.go:53 +0x1d84
  main.main()
      /root/fsp2p/cmd/main.go:51 +0x2e
==================
@wlynxg wlynxg linked a pull request Jan 16, 2025 that will close this issue
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 a pull request may close this issue.

1 participant