Giter Site home page Giter Site logo

Comments (5)

chzyer avatar chzyer commented on May 21, 2024

@knz Thanks! It's fixed now.

from readline.

knz avatar knz commented on May 21, 2024

Hum I'm sorry but no it's not fixed. promptLen is not protected by the mutex. Look at the original trace:

Write at 0x00c42043c5a0 by goroutine 19:
  github.com/chzyer/readline.(*RuneBuffer).SetPrompt()
      /mnt/kena/go/src/github.com/chzyer/readline/runebuf.go:503 +0xa0
  github.com/chzyer/readline.(*Operation).SetPrompt()
      /mnt/kena/go/src/github.com/chzyer/readline/operation.go:87 +0x62
  github.com/chzyer/readline.(*Instance).SetPrompt()
      /mnt/kena/go/src/github.com/chzyer/readline/readline.go:168 +0x62
  github.com/cockroachdb/cockroach/cli.runInteractive()
      /mnt/kena/go/src/github.com/cockroachdb/cockroach/cli/sql.go:286 +0x234
  github.com/cockroachdb/cockroach/cli.TestSQLLex.func2()
      /mnt/kena/go/src/github.com/cockroachdb/cockroach/cli/sql_test.go:117 +0x61
  github.com/cockroachdb/cockroach/cli.captureOutput()
      /mnt/kena/go/src/github.com/cockroachdb/cockroach/cli/cli_test.go:164 +0x1bc
  github.com/cockroachdb/cockroach/cli.TestSQLLex()
      /mnt/kena/go/src/github.com/cockroachdb/cockroach/cli/sql_test.go:121 +0x5f6
  testing.tRunner()
      /mnt/kena/go1.7rc5/src/testing/testing.go:610 +0xc9

Previous read at 0x00c42043c5a0 by goroutine 133:
  github.com/chzyer/readline.(*RuneBuffer).promptLen()
      /mnt/kena/go/src/github.com/chzyer/readline/runebuf.go:85 +0x5c
  github.com/chzyer/readline.(*RuneBuffer).getSplitByLine()
      /mnt/kena/go/src/github.com/chzyer/readline/runebuf.go:381 +0x3c
  github.com/chzyer/readline.(*RuneBuffer).IdxLine()
      /mnt/kena/go/src/github.com/chzyer/readline/runebuf.go:388 +0xaa
  github.com/chzyer/readline.(*RuneBuffer).Clean()
      /mnt/kena/go/src/github.com/chzyer/readline/runebuf.go:530 +0x53
  github.com/chzyer/readline.(*Operation).ioloop()
      /mnt/kena/go/src/github.com/chzyer/readline/operation.go:101 +0x3286

As you can see the race is with IdxLine which uses .... promptLen which is not protected.

from readline.

chzyer avatar chzyer commented on May 21, 2024

Yes, you are right.
What's command you run to detect race condition?
I have try go test -race -run=TestMain in corkroachdb before, but it's passed.

from readline.

knz avatar knz commented on May 21, 2024

make testrace PKG=./cli TESTS=TestSQLLex

Run this from the branch fix-sql-comment from https://github.com/knz/cockroach though.

from readline.

chzyer avatar chzyer commented on May 21, 2024

@knz
It should fixed now. :) Sorry for the later fix.

from readline.

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.