Giter Site home page Giter Site logo

data race about croc HOT 4 CLOSED

 avatar commented on May 14, 2024
data race

from croc.

Comments (4)

 avatar commented on May 14, 2024

one more case

croc

                                ,_
                               >' )
   croc version                ( ( \
                                || \
                 /^^^^\         ||
    /^^\________/0     \        ||
   (                    `~+++,,_||__,,++~^^^^^^^
 ...V^V^V^V^V^V^\...............................


Enter receive code: 4-happy-diego-tribune
The specifed code is already in use by a sender.
==================
WARNING: DATA RACE
Write at 0x00c42008428a by goroutine 11:
  main.(*Connection).runClient.func1()
      /Users/callmeanyhow/go/src/croc/connect.go:298 +0xd86

Previous write at 0x00c42008428a by goroutine 7:
  main.(*Connection).runClient.func1()
      /Users/callmeanyhow/go/src/croc/connect.go:298 +0xd86

Goroutine 11 (running) created at:
  main.(*Connection).runClient()
      /Users/callmeanyhow/go/src/croc/connect.go:231 +0x510
  main.(*Connection).Run()
      /Users/callmeanyhow/go/src/croc/connect.go:206 +0x80b
  main.main()
      /Users/callmeanyhow/go/src/croc/main.go:66 +0x573

Goroutine 7 (finished) created at:
  main.(*Connection).runClient()
      /Users/callmeanyhow/go/src/croc/connect.go:231 +0x510
  main.(*Connection).Run()
      /Users/callmeanyhow/go/src/croc/connect.go:206 +0x80b
  main.main()
      /Users/callmeanyhow/go/src/croc/main.go:66 +0x573
==================
Found 1 data race(s)

from croc.

schollz avatar schollz commented on May 14, 2024

Whoa! How did you get these errors, just by go get and then running? I've never seen errors like these before.

from croc.

 avatar commented on May 14, 2024

Almost) I used standard golang race detector go install -race .

from croc.

schollz avatar schollz commented on May 14, 2024

Okay, thanks. The problem is how data is being shared. Namely these contain switches: https://github.com/schollz/croc/blob/master/connect.go#L224-L228. These switches can be turned off/on simultaneously by threads which causes data racing. It should be fixed now since I added a sync.RWMutex to hold these switches.

from croc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.