{"action":"created","issue":{"url":"https://api.github.com/repos/jinzhu/gorm/issues/747","labels_url":"https://api.github.com/repos/jinzhu/gorm/issues/747/labels{/name}","comments_url":"https://api.github.com/repos/jinzhu/gorm/issues/747/comments","events_url":"https://api.github.com/repos/jinzhu/gorm/issues/747/events","html_url":"https://github.com/jinzhu/gorm/issues/747","id":119900084,"number":747,"title":"Getting panic on rollback ","user":{"login":"danbogos","id":1607526,"avatar_url":"https://avatars.githubusercontent.com/u/1607526?v=3","gravatar_id":"","url":"https://api.github.com/users/danbogos","html_url":"https://github.com/danbogos","followers_url":"https://api.github.com/users/danbogos/followers","following_url":"https://api.github.com/users/danbogos/following{/other_user}","gists_url":"https://api.github.com/users/danbogos/gists{/gist_id}","starred_url":"https://api.github.com/users/danbogos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danbogos/subscriptions","organizations_url":"https://api.github.com/users/danbogos/orgs","repos_url":"https://api.github.com/users/danbogos/repos","events_url":"https://api.github.com/users/danbogos/events{/privacy}","received_events_url":"https://api.github.com/users/danbogos/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-02T09:24:28Z","updated_at":"2015-12-11T12:10:50Z","closed_at":"2015-12-11T04:10:45Z","body":"Hey,\r\n\r\nThank you for this neat package, it serves us well!\r\n\r\nNot sure if you got already this panic handled and you already have some tips for us but when MySQL is not accepting new connections, we will get panic on rollback. Bellow the strace. Thanks in advance for any kind of tip!\r\n\r\n```\r\n2015/12/02 11:36:35 http: panic serving 192.168.133.154:39506: runtime error: invalid memory address or nil pointer dereference\r\ngoroutine 1485 [running]:\r\nnet/http.(*conn).serve.func1(0xc8204ae790, 0x7f7d0857cb30, 0xc820026190)\r\n        /usr/local/go/src/net/http/server.go:1287 +0xb5\r\ndatabase/sql.(*Tx).Rollback(0x0, 0x0, 0x0)\r\n        /usr/local/go/src/database/sql/sql.go:1149 +0x28\r\ngithub.com/jinzhu/gorm.(*DB).Rollback(0xc8208370e0, 0xdd8580)\r\n        /home/byron/GOPATH/src/github.com/jinzhu/gorm/main.go:360 +0x8d\r\ngithub.com/cgrates/cgrates/engine.(*SQLStorage).SetCdr(0xc820094000, 0xc821026680, 0x0, 0x0)\r\n        /home/byron/GOPATH/src/github.com/cgrates/cgrates/engine/storage_sql.go:626 +0x746\r\ngithub.com/cgrates/cgrates/engine.(*CdrServer).processCdr(0xc820492230, 0xc821026680, 0x0, 0x0)\r\n        /home/byron/GOPATH/src/github.com/cgrates/cgrates/engine/cdrs.go:206 +0x3c8\r\ngithub.com/cgrates/cgrates/engine.fsCdrHandler(0x7f7d08584430, 0xc820095e40, 0xc8214cc000)\r\n        /home/byron/GOPATH/src/github.com/cgrates/cgrates/engine/cdrs.go:63 +0x2ab\r\nnet/http.HandlerFunc.ServeHTTP(0x115dd10, 0x7f7d08584430, 0xc820095e40, 0xc8214cc000)\r\n        /usr/local/go/src/net/http/server.go:1422 +0x3a\r\nnet/http.(*ServeMux).ServeHTTP(0xc820065050, 0x7f7d08584430, 0xc820095e40, 0xc8214cc000)\r\n        /usr/local/go/src/net/http/server.go:1699 +0x17d\r\nnet/http.serverHandler.ServeHTTP(0xc820061200, 0x7f7d08584430, 0xc820095e40, 0xc8214cc000)\r\n        /usr/local/go/src/net/http/server.go:1862 +0x19e\r\nnet/http.(*conn).serve(0xc8204ae790)\r\n        /usr/local/go/src/net/http/server.go:1361 +0xbee\r\ncreated by net/http.(*Server).Serve\r\n        /usr/local/go/src/net/http/server.go:1910 +0x3f6\r\n\r\n(Error 1040: Too many connections) \r\n[2015-12-02 11:36:35]  \r\n\r\n(Error 1040: Too many connections) \r\n[2015-12-02 11:36:35]  \r\n2015/12/02 11:36:36 http: panic serving 192.168.133.154:39508: runtime error: invalid memory address or nil pointer dereference\r\ngoroutine 1510 [running]:\r\nnet/http.(*conn).serve.func1(0xc8204ae790, 0x7f7d0857cb30, 0xc820534068)\r\n        /usr/local/go/src/net/http/server.go:1287 +0xb5\r\ndatabase/sql.(*Tx).Rollback(0x0, 0x0, 0x0)\r\n        /usr/local/go/src/database/sql/sql.go:1149 +0x28\r\ngithub.com/jinzhu/gorm.(*DB).Rollback(0xc821273d60, 0xdd8580)\r\n        /home/byron/GOPATH/src/github.com/jinzhu/gorm/main.go:360 +0x8d\r\ngithub.com/cgrates/cgrates/engine.(*SQLStorage).SetCdr(0xc820094000, 0xc8210264e0, 0x0, 0x0)\r\n        /home/byron/GOPATH/src/github.com/cgrates/cgrates/engine/storage_sql.go:626 +0x746\r\ngithub.com/cgrates/cgrates/engine.(*CdrServer).processCdr(0xc820492230, 0xc8210264e0, 0x0, 0x0)\r\n        /home/byron/GOPATH/src/github.com/cgrates/cgrates/engine/cdrs.go:206 +0x3c8\r\ngithub.com/cgrates/cgrates/engine.fsCdrHandler(0x7f7d08584430, 0xc820095e40, 0xc8214cc000)\r\n        /home/byron/GOPATH/src/github.com/cgrates/cgrates/engine/cdrs.go:63 +0x2ab\r\nnet/http.HandlerFunc.ServeHTTP(0x115dd10, 0x7f7d08584430, 0xc820095e40, 0xc8214cc000)\r\n        /usr/local/go/src/net/http/server.go:1422 +0x3a\r\nnet/http.(*ServeMux).ServeHTTP(0xc820065050, 0x7f7d08584430, 0xc820095e40, 0xc8214cc000)\r\n        /usr/local/go/src/net/http/server.go:1699 +0x17d\r\nnet/http.serverHandler.ServeHTTP(0xc820061200, 0x7f7d08584430, 0xc820095e40, 0xc8214cc000)\r\n        /usr/local/go/src/net/http/server.go:1862 +0x19e\r\nnet/http.(*conn).serve(0xc8204ae790)\r\n        /usr/local/go/src/net/http/server.go:1361 +0xbee\r\ncreated by net/http.(*Server).Serve\r\n        /usr/local/go/src/net/http/server.go:1910 +0x3f6\r\n\r\n(Error 1040: Too many connections) \r\n[2015-12-02 11:36:36]  \r\n\r\n(Error 1040: Too many connections) \r\n[2015-12-02 11:36:36]  \r\n2015/12/02 11:36:36 http: panic serving 192.168.133.154:39509: runtime error: invalid memory address or nil pointer dereference\r\ngoroutine 1519 [running]:\r\nnet/http.(*conn).serve.func1(0xc8207c6630, 0x7f7d0857cb30, 0xc82006d998)\r\n        /usr/local/go/src/net/http/server.go:1287 +0xb5\r\ndatabase/sql.(*Tx).Rollback(0x0, 0x0, 0x0)\r\n        /usr/local/go/src/database/sql/sql.go:1149 +0x28\r\ngithub.com/jinzhu/gorm.(*DB).Rollback(0xc820ddf040, 0xdd8580)\r\n        /home/byron/GOPATH/src/github.com/jinzhu/gorm/main.go:360 +0x8d\r\ngithub.com/cgrates/cgrates/engine.(*SQLStorage).SetCdr(0xc820094000, 0xc820bab860, 0x0, 0x0)\r\n        /home/byron/GOPATH/src/github.com/cgrates/cgrates/engine/storage_sql.go:626 +0x746\r\ngithub.com/cgrates/cgrates/engine.(*CdrServer).processCdr(0xc820492230, 0xc820bab860, 0x0, 0x0)\r\n        /home/byron/GOPATH/src/github.com/cgrates/cgrates/engine/cdrs.go:206 +0x3c8\r\ngithub.com/cgrates/cgrates/engine.fsCdrHandler(0x7f7d08584430, 0xc8207c66e0, 0xc820f6fc00)\r\n        /home/byron/GOPATH/src/github.com/cgrates/cgrates/engine/cdrs.go:63 +0x2ab\r\nnet/http.HandlerFunc.ServeHTTP(0x115dd10, 0x7f7d08584430, 0xc8207c66e0, 0xc820f6fc00)\r\n        /usr/local/go/src/net/http/server.go:1422 +0x3a\r\nnet/http.(*ServeMux).ServeHTTP(0xc820065050, 0x7f7d08584430, 0xc8207c66e0, 0xc820f6fc00)\r\n        /usr/local/go/src/net/http/server.go:1699 +0x17d\r\nnet/http.serverHandler.ServeHTTP(0xc820061200, 0x7f7d08584430, 0xc8207c66e0, 0xc820f6fc00)\r\n        /usr/local/go/src/net/http/server.go:1862 +0x19e\r\nnet/http.(*conn).serve(0xc8207c6630)\r\n        /usr/local/go/src/net/http/server.go:1361 +0xbee\r\ncreated by net/http.(*Server).Serve\r\n        /usr/local/go/src/net/http/server.go:1910 +0x3f6\r\n\r\n(Error 1040: Too many connections) \r\n[2015-12-02 11:36:36] \r\n```\r\nDanB"},"comment":{"url":"https://api.github.com/repos/jinzhu/gorm/issues/comments/163924046","html_url":"https://github.com/jinzhu/gorm/issues/747#issuecomment-163924046","issue_url":"https://api.github.com/repos/jinzhu/gorm/issues/747","id":163924046,"user":{"login":"danbogos","id":1607526,"avatar_url":"https://avatars.githubusercontent.com/u/1607526?v=3","gravatar_id":"","url":"https://api.github.com/users/danbogos","html_url":"https://github.com/danbogos","followers_url":"https://api.github.com/users/danbogos/followers","following_url":"https://api.github.com/users/danbogos/following{/other_user}","gists_url":"https://api.github.com/users/danbogos/gists{/gist_id}","starred_url":"https://api.github.com/users/danbogos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danbogos/subscriptions","organizations_url":"https://api.github.com/users/danbogos/orgs","repos_url":"https://api.github.com/users/danbogos/repos","events_url":"https://api.github.com/users/danbogos/events{/privacy}","received_events_url":"https://api.github.com/users/danbogos/received_events","type":"User","site_admin":false},"created_at":"2015-12-11T12:10:49Z","updated_at":"2015-12-11T12:10:49Z","body":"Hi @jinzhu \r\n\r\nThanks for checking it out. If by any chance you hit the panic in the future, please inform me in this issue.\r\n\r\nThanks again!\r\n\r\nDanB"}}