Comments (10)
could you add some tests on this?
from stats.
I am not sure how to make this tests not so ugly )
#14
from stats.
It cause panic only if use go 1.6. I am not sure how to test it on previous versions.
from stats.
It seem that the returns of Data() function include the maps (references) from Stats structure, any further access to those maps is not protected by RWMutex (privated in Stats)
from stats.
Hi!
Any news on this?
I'm also having this issue on traefik traefik/traefik#458.
We are getting this error while json encoding the Data struct:
fatal error: concurrent map read and map write
goroutine 6569 [running]:
runtime.throw(0x10932c0, 0x21)
/usr/local/go/src/runtime/panic.go:547 +0x90 fp=0xc8213b1128 sp=0xc8213b1110
runtime.mapaccess2(0xc27f20, 0xc8202a99b0, 0xc82000bb10, 0x3, 0x6c7d9e)
/usr/local/go/src/runtime/hashmap.go:343 +0x5a fp=0xc8213b1170 sp=0xc8213b1128
reflect.mapaccess(0xc27f20, 0xc8202a99b0, 0xc82000bb10, 0xc8202a99b0)
/usr/local/go/src/runtime/hashmap.go:993 +0x35 fp=0xc8213b11a0 sp=0xc8213b1170
reflect.Value.MapIndex(0xc27f20, 0xc830c04160, 0x195, 0xc2caa0, 0xc82000bb10, 0x98, 0x0, 0x0, 0x0)
/usr/local/go/src/reflect/value.go:1041 +0x14a fp=0xc8213b1228 sp=0xc8213b11a0
encoding/json.(*mapEncoder).encode(0xc825a10310, 0xc8306c00b0, 0xc27f20, 0xc830c04160, 0x195, 0x0)
/usr/local/go/src/encoding/json/encode.go:622 +0x2ec fp=0xc8213b1318 sp=0xc8213b1228
encoding/json.(*mapEncoder).(encoding/json.encode)-fm(0xc8306c00b0, 0xc27f20, 0xc830c04160, 0x195, 0x0)
/usr/local/go/src/encoding/json/encode.go:632 +0x51 fp=0xc8213b1350 sp=0xc8213b1318
encoding/json.(*structEncoder).encode(0xc8258dcb40, 0xc8306c00b0, 0xf2a9a0, 0xc830c04120, 0x199, 0x0)
/usr/local/go/src/encoding/json/encode.go:587 +0x2c4 fp=0xc8213b14f8 sp=0xc8213b1350
encoding/json.(*structEncoder).(encoding/json.encode)-fm(0xc8306c00b0, 0xf2a9a0, 0xc830c04120, 0x199, 0xc830c04100)
/usr/local/go/src/encoding/json/encode.go:601 +0x51 fp=0xc8213b1530 sp=0xc8213b14f8
encoding/json.(*ptrEncoder).encode(0xc825a10350, 0xc8306c00b0, 0xbd76a0, 0xc830c04120, 0x16, 0x0)
/usr/local/go/src/encoding/json/encode.go:709 +0xea fp=0xc8213b1580 sp=0xc8213b1530
encoding/json.(*ptrEncoder).(encoding/json.encode)-fm(0xc8306c00b0, 0xbd76a0, 0xc830c04120, 0x16, 0xc830c04100)
/usr/local/go/src/encoding/json/encode.go:714 +0x51 fp=0xc8213b15b8 sp=0xc8213b1580
encoding/json.(*encodeState).reflectValue(0xc8306c00b0, 0xbd76a0, 0xc830c04120, 0x16)
/usr/local/go/src/encoding/json/encode.go:301 +0x6b fp=0xc8213b15e8 sp=0xc8213b15b8
encoding/json.(*encodeState).marshal(0xc8306c00b0, 0xbd76a0, 0xc830c04120, 0x0, 0x0)
/usr/local/go/src/encoding/json/encode.go:274 +0xa9 fp=0xc8213b1630 sp=0xc8213b15e8
encoding/json.Marshal(0xbd76a0, 0xc830c04120, 0x0, 0x0, 0x0, 0x0, 0x0)
from stats.
Ping @thoas :)
from stats.
will look into this, you can send me a PR if you want :)
from stats.
fixed
from stats.
reopening still not fixed
from stats.
fixed in master
from stats.
Related Issues (20)
- beego support HOT 3
- Support httprouter HOT 2
- Negroni middleware records stats usage for the /stats route HOT 1
- Any thoughts on how this could integrate with Gorilla Mux? HOT 1
- RecorderResponseWriter does not implement negroni.ResponseWriter HOT 1
- integrate with expvar HOT 1
- Example for Gin doesn't work (anymore?) HOT 1
- Project abandoned? HOT 3
- Integration with labstack/echo
- wrong status code of middleware
- use martini status_code_count and total_status_code_count code question, HOT 1
- Add example for go-chi HOT 1
- Bogus HTTP response status code stats HOT 2
- Why reset Response Counts?
- Latest check in breaks my build HOT 1
- o.saveResult undefined (type *Options has no field or method saveResult HOT 1
- *Options has no field or method saveResult HOT 1
- Possible false response code
- Is prometheus supported?
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 stats.