Closed TBWISK closed 6 years ago
and this fault happend when trandsMongoTable is large ; when trandsMongoTable len is 3 . this fault not happend
Hi @TBWISK
Your stack trace is missing the line that says what the error is.
Dom
@domodwyer it look like lock question .semacquire error. it crash when is error happend .this app would destory , and when I try to use defer recover to catch it ,but fail ! next time I would upgrade go version to 1.9.5 , and try it after ,it would be know what happend
Sorry , I use 2&1 to get all err log . and know what happen. my code wrong cause all goroutine raise error . And my code error is that I don't lock my map . and this time this map used by write and read.
go version:1.9.2 linux version: uname -a
mgo version : glide get github.com/globalsign/mgo it look like master version Linux dmp-test01 2.6.32-696.3.2.el6.x86_64 #1 SMP Tue Jun 20 01:26:55 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
how to use: mgoSession, err = mgo.Dial(GetParms(mongodbURL)) if err != nil { panic(err) } mgoSession.SetMode(mgo.Monotonic, true) ...
func GetUserInfo(ID string) (map[string]interface{}, error) { var mapResult map[string]interface{} s := mgoSession.Clone() // fmt.Println("req", trandsMongoTable) err := s.DB("wead-dmp").C("wax_req_user_flag_info").Find(bson.M{"_id": ID}).Select(trandsMongoTable).One(&mapResult) s.Close() if err != nil { return nil, err } // return fortmatUserInfo(map_result, nil) return mapResult, nil } ... and trandsMongoTable is make(bson.M) and value = map[gender:1 interest_100205:1 interest_101902:1 interest_100101:1 interest_101704:1 interest_100803:1 interest_100504:1 house:1 educate:1 interest_100703:1 interest_100702:1 interest_100501:1 interest_100601:1 interest_100301:1 app_20000:1 position:1 interest_101301:1 interest_101502:1 app_10500:1 interest_101603:1 model_price_cate:1 interest_100602:1 interest_101205:1 interest_101406:1 interest_100903:1 province_area:1 interest_101503:1 car:1 interest_101604:1 interest_101501:1 interest_101801:1 interest_101804:1 interest_100503:1 interest_101405:1 love:1 interest_101002:1 interest_100901:1 interest_100603:1 ip_city_addr:1 interest_101401:1 agerange:1 city_level:1 ip_provin_addr:1 os:1 interest_101203:1 interest_101204:1]
error code goroutine 220 [semacquire]: sync.runtimeSemacquireMutex(0xc42bca3adc, 0x71d700) /usr/local/go/src/runtime/sema.go:71 +0x3d sync.(Mutex).Lock(0xc42bca3ad8) /usr/local/go/src/sync/mutex.go:134 +0xee github.com/globalsign/mgo.(mongoSocket).SimpleQuery(0xc4201260f0, 0xc42bc72a50, 0xc400000001, 0x1, 0x0, 0x0, 0xc42bcc9b01) /data/jenkins/workspace/test-go-adbright-dmp/adbright-dmp/src/github.com/globalsign/mgo/socket.go:390 +0x235 github.com/globalsign/mgo.(*Query).One(0xc42bcbed80, 0x711000, 0xc42aed8d70, 0x0, 0x0) /data/jenkins/workspace/test-go-adbright-dmp/adbright-dmp/src/github.com/globalsign/mgo/session.go:3409 +0x180 /data/jenkins/workspace/test-go-adbright-dmp/adbright-dmp/utils.GetUserInfo(0xc42bbcd7c0, 0x20, 0x9169f90f4, 0xc42588f188, 0x6cb992) /data/jenkins/workspace/test-go-adbright-dmp/adbright-dmp/utils/mongoutils.go:505 +0x39b /data/jenkins/workspace/test-go-adbright-dmp/adbright-dmp/ruleprocesser.(ScoreManager).GetUserInfo(0xc42560f280, 0xc42bbcd7c0, 0x20, 0xc42bc4d360) /data/jenkins/workspace/test-go-adbright-dmp/adbright-dmp/ruleprocesser/WaxRealCal.go:389 +0x39 _/data/jenkins/workspace/test-go-adbright-dmp/adbright-dmp/ruleprocesser.(ScoreManager).CalAllModel(0xc42560f280, 0xc42bbcd7c0, 0x20, 0x7, 0xc4256f4438, 0xc42bc84301) /data/jenkins/workspace/test-go-adbright-dmp/adbright-dmp/ruleprocesser/WaxRealCal.go:338 +0xe3 /data/jenkins/workspace/test-go-adbright-dmp/adbright-dmp/ruleprocesser.(*DataPackageTrade).Solver(0xc4201a0d20, 0xc400000001, 0xc42bbcd7c0, 0x20, 0x0, 0x0, 0xc42bca3ab0, 0xd, 0xc42bca3ac0, 0xb, ...) /data/jenkins/workspace/test-go-adbright-dmp/adbright-dmp/ruleprocesser/DataPackageTrade.go:120 +0xb40 /data/jenkins/workspace/test-go-adbright-dmp/adbright-dmp/handler.(MainHandler).QueryRules(0xc425679920, 0x9375c0, 0xc420016110, 0x1, 0xc42bc5b110, 0x63, 0xc42bba9b40, 0x32, 0x0, 0x0, ...) /data/jenkins/workspace/test-go-adbright-dmp/adbright-dmp/handler/mainhandler.go:154 +0xa77 _/data/jenkins/workspace/test-go-adbright-dmp/adbright-dmp/dmp.(weadDmpProcessorQueryRules).Process(0xc425681080, 0x9375c0, 0xc420016110, 0x0, 0x93c9e0, 0xc425754360, 0x93c9e0, 0xc4257543f0, 0xc420025e01, 0x0, ...) /data/jenkins/workspace/test-go-adbright-dmp/adbright-dmp/dmp/dmp.go:265 +0x2ff _/data/jenkins/workspace/test-go-adbright-dmp/adbright-dmp/dmp.(WeadDmpProcessor).Process(0xc425679940, 0x9375c0, 0xc420016110, 0x93c9e0, 0xc425754360, 0x93c9e0, 0xc4257543f0, 0xc425630901, 0x0, 0x0) /data/jenkins/workspace/test-go-adbright-dmp/adbright-dmp/dmp/dmp.go:136 +0x336 main.(TADBSimpleServer).processRequests(0xc425623b00, 0x938e20, 0xc42572fbc0, 0x0, 0x0) /data/jenkins/workspace/test-go-adbright-dmp/adbright-dmp/ad_server.go:251 +0x28c main.(TADBSimpleServer).AcceptLoop.func1(0xc425623b00, 0x938e20, 0xc42572fbc0) /data/jenkins/workspace/test-go-adbright-dmp/adbright-dmp/ad_server.go:191 +0x6d created by main.(TADBSimpleServer).AcceptLoop /data/jenkins/workspace/test-go-adbright-dmp/adbright-dmp/ad_server.go:184 +0x4b9