Comments (5)
@knz Thanks! It's fixed now.
from readline.
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.
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.
make testrace PKG=./cli TESTS=TestSQLLex
Run this from the branch fix-sql-comment
from https://github.com/knz/cockroach though.
from readline.
@knz
It should fixed now. :) Sorry for the later fix.
from readline.
Related Issues (20)
- Data race between `Operation.ioloop()` and `Operation.SetConfig()`
- How do I complete a file path HOT 1
- how to modify Prompt
- Autocomplete CharBackspace behaviour question HOT 1
- readline.ListenRemote and telnet connection
- Support multi-line edit
- Breaks terminal when used '\n' in promt
- data race warning
- the serial terminal key is invalid or stuck
- change of color (ANSI color code unchaged) when calling `log.SetOutput(l.Stderr())` HOT 4
- `(*Instance).Close()` hangs if there is a concurrent `(*Instance).ReadLine` call
- data race in history search
- TOCTOU race in prompt redraw
- Add a security policy HOT 1
- Example how to use library with old UNIX CLI tools like Oracle sqlplus or rman
- Can I use `readline.NewRawReader()` as `os.Stdin` on Windows? Can `readline.NewRawReader()` support `Ctrl + Space`? HOT 1
- bug
- Fails to read piped stdin in windows
- Reading from differents threads sharing the same Instance
- In Ansi_ The ColorTableFg in the windows.go file may have an array out of bounds HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from readline.