Skip to content

Data race in connection management #9102

Closed

Description

@calmh

Probably I screwed this up in the multi-con stuff

=== RUN   TestConnCloseOnRestart
==================
WARNING: DATA RACE
Read at 0x00c00a2d7eb0 by goroutine 11372:
  github.com/syncthing/syncthing/lib/protocol.(*rawConnection).internalClose.func1()
      /home/runner/work/syncthing/syncthing/lib/protocol/protocol.go:982 +0x8ca
  sync.(*Once).doSlow()
      /opt/hostedtoolcache/go/1.20.8/x64/src/sync/once.go:74 +0x101
  sync.(*Once).Do()
      /opt/hostedtoolcache/go/1.20.8/x64/src/sync/once.go:65 +0x46
  github.com/syncthing/syncthing/lib/protocol.(*rawConnection).internalClose()
      /home/runner/work/syncthing/syncthing/lib/protocol/protocol.go:966 +0x74
  github.com/syncthing/syncthing/lib/protocol.(*rawConnection).Close.func2()
      /home/runner/work/syncthing/syncthing/lib/protocol/protocol.go:961 +0x58

Previous write at 0x00c00a2d7eb0 by goroutine 11328:
  github.com/syncthing/syncthing/lib/protocol.(*rawConnection).Start()
      /home/runner/work/syncthing/syncthing/lib/protocol/protocol.go:320 +0x2cc
  github.com/syncthing/syncthing/lib/protocol.encryptedConnection.Start()
      /home/runner/work/syncthing/syncthing/lib/protocol/encryption.go:181 +0x70
  github.com/syncthing/syncthing/lib/protocol.(*encryptedConnection).Start()
      <autogenerated>:1 +0x25
  github.com/syncthing/syncthing/lib/protocol.(*wireFormatConnection).Start()
      <autogenerated>:1 +0x4c
  github.com/syncthing/syncthing/lib/model.(*model).promoteConnections()
      /home/runner/work/syncthing/syncthing/lib/model/model.go:2426 +0x863
  github.com/syncthing/syncthing/lib/model.(*model).serve()
      /home/runner/work/syncthing/syncthing/lib/model/model.go:288 +0x418
  github.com/syncthing/syncthing/lib/model.(*model).serve-fm()
      <autogenerated>:1 +0x4d
  github.com/syncthing/syncthing/lib/svcutil.(*service).Serve()
      /home/runner/work/syncthing/syncthing/lib/svcutil/svcutil.go:130 +0xed
  github.com/thejerf/suture/v4.(*Supervisor).runService.func2()
      /home/runner/go/pkg/mod/github.com/thejerf/suture/[email protected]/supervisor.go:565 +0x1c8

Goroutine 11372 (running) created at:
  github.com/syncthing/syncthing/lib/protocol.(*rawConnection).Close()
      /home/runner/work/syncthing/syncthing/lib/protocol/protocol.go:961 +0x12a
  github.com/syncthing/syncthing/lib/protocol.encryptedConnection.Close()
      /home/runner/work/syncthing/syncthing/lib/protocol/encryption.go:254 +0x8b
  github.com/syncthing/syncthing/lib/protocol.(*encryptedConnection).Close()
      <autogenerated>:1 +0x29
  github.com/syncthing/syncthing/lib/protocol.(*wireFormatConnection).Close()
      <autogenerated>:1 +0x63
  github.com/syncthing/syncthing/lib/model.(*model).CommitConfiguration.func2()
      /home/runner/work/syncthing/syncthing/lib/model/model.go:3123 +0x67

Goroutine 11328 (running) created at:
  github.com/thejerf/suture/v4.(*Supervisor).runService()
      /home/runner/go/pkg/mod/github.com/thejerf/suture/[email protected]/supervisor.go:539 +0x32c
  github.com/thejerf/suture/v4.(*Supervisor).Serve()
      /home/runner/go/pkg/mod/github.com/thejerf/suture/[email protected]/supervisor.go:348 +0x409
  github.com/syncthing/syncthing/lib/model.(*testModel).ServeBackground.func1()
      /home/runner/work/syncthing/syncthing/lib/model/testutils_test.go:171 +0x73
==================
    testing.go:1446: race detected during execution of test
--- FAIL: TestConnCloseOnRestart (0.03s)

Activity

  1. added
    bug
    needs-triage
    skip-changelog
    and removed
    needs-triage
    on Sep 12, 2023
  2. added a commit that references this issue on Sep 12, 2023
    6f3fd2a
  3. calmh commented on Sep 12, 2023

    @calmh
    MemberAuthor

    Actually I think the screwup was present before as well, my change just highlighted it by touching a variable that the race detector was looking after. I don't think this ever happens outside of tests, regardless.

  4. added this to the v1.25.0 milestone on Sep 12, 2023
  5. added a commit that references this issue on Oct 15, 2023
    917698d
  6. added a commit that references this issue on Jan 28, 2024
    f47de83
  7. added
    frozen-due-to-age
    on Sep 11, 2024
  8. locked and limited conversation to collaborators on Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugfrozen-due-to-ageskip-changelog

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions