generate.vim: data race in VimBuffer
ezradiniz opened this issue · 0 comments
ezradiniz commented
I ran the vim-bootstrap-server
and hit a data race requesting several configurations at the same time.
#!/usr/bin/env bash
theme="$1"
while true; do
colorscheme=$(curl -sS -d "theme=$theme" http://localhost:3000/generate.vim | grep colorscheme)
if [ "$colorscheme" == "colorscheme $theme" ]; then
echo "Ok: $colorscheme"
else
echo "Bad: $colorscheme"
exit 1
fi
done
Try to run the above script at the same time and you will have a data race.
# Run this at same time
$ ./run.sh wombat
$ ./run.sh molokai
Data race output
WARNING: DATA RACE
Read at 0x00c000237118 by goroutine 87:
runtime.slicecopy()
/usr/lib/go/src/runtime/slice.go:247 +0x0
bytes.(*Buffer).grow()
/usr/lib/go/src/bytes/buffer.go:143 +0x269
bytes.(*Buffer).Write()
/usr/lib/go/src/bytes/buffer.go:172 +0x184
text/template.(*state).walk()
/usr/lib/go/src/text/template/exec.go:271 +0x747
text/template.(*state).walk()
/usr/lib/go/src/text/template/exec.go:264 +0x1a4
text/template.(*Template).execute()
/usr/lib/go/src/text/template/exec.go:220 +0x2fb
text/template.(*Template).Execute()
/usr/lib/go/src/text/template/exec.go:203 +0xaa4
github.com/editor-bootstrap/vim-bootstrap/generate.Generate()
/home/ezra/dev/thirdparty/vim-bootstrap/generate/generate.go:130 +0xa66
github.com/editor-bootstrap/vim-bootstrap/web.HandleGenerate()
/home/ezra/dev/thirdparty/vim-bootstrap/web/web.go:49 +0x484
net/http.HandlerFunc.ServeHTTP()
/usr/lib/go/src/net/http/server.go:2069 +0x51
github.com/gorilla/mux.(*Router).ServeHTTP()
/home/ezra/go/pkg/mod/github.com/gorilla/mux@v1.8.0/mux.go:210 +0x132
github.com/urfave/negroni.Wrap.func1()
/home/ezra/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:46 +0x68
github.com/urfave/negroni.HandlerFunc.ServeHTTP()
/home/ezra/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29 +0x5b
github.com/urfave/negroni.middleware.ServeHTTP()
/home/ezra/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38 +0x116
github.com/urfave/negroni.middleware.ServeHTTP-fm()
/home/ezra/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:37 +0x7e
github.com/urfave/negroni.(*Static).ServeHTTP()
/home/ezra/go/pkg/mod/github.com/urfave/negroni@v1.0.0/static.go:34 +0x99b
github.com/urfave/negroni.middleware.ServeHTTP()
/home/ezra/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38 +0x116
github.com/urfave/negroni.middleware.ServeHTTP-fm()
/home/ezra/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:37 +0x7e
github.com/urfave/negroni.(*Logger).ServeHTTP()
/home/ezra/go/pkg/mod/github.com/urfave/negroni@v1.0.0/logger.go:62 +0x9c
github.com/urfave/negroni.middleware.ServeHTTP()
/home/ezra/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38 +0x116
github.com/urfave/negroni.middleware.ServeHTTP-fm()
/home/ezra/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:37 +0x7e
github.com/urfave/negroni.(*Recovery).ServeHTTP()
/home/ezra/go/pkg/mod/github.com/urfave/negroni@v1.0.0/recovery.go:193 +0xd6
github.com/urfave/negroni.middleware.ServeHTTP()
/home/ezra/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38 +0x116
github.com/urfave/negroni.(*Negroni).ServeHTTP()
/home/ezra/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:96 +0x186
net/http.serverHandler.ServeHTTP()
/usr/lib/go/src/net/http/server.go:2887 +0xca
net/http.(*conn).serve()
/usr/lib/go/src/net/http/server.go:1952 +0x87d