Closed tthdvd closed 5 years ago
I have a (very) similar problem with mattermost 4.8: my stack trace is
github.com/mattermost/mattermost-server/model/gitlab.(*GitLabUser).IsValid(...)
/var/lib/jenkins/jobs/msr/jobs/d/jobs/enterprise-release/workspace/src/github.com/mattermost/mattermost-server/model/gitlab/gitlab.go:78
github.com/mattermost/mattermost-server/model/gitlab.(*GitLabProvider).GetAuthDataFromJson(0x246aa78, 0x1d159e0, 0xc423812390, 0x6, 0xc42008b288)
/var/lib/jenkins/jobs/msr/jobs/d/jobs/enterprise-release/workspace/src/github.com/mattermost/mattermost-server/model/gitlab/gitlab.go:109 +0x3a
from (*GitLabProvider).GetAuthDataFromJson
while yours is from (*GitLabProvider).GetUserFromJson
.
The root cause seems a null-pointer dereference in https://github.com/mattermost/mattermost-server/blob/release-5.2/model/gitlab/gitlab.go#L78, which means that https://github.com/mattermost/mattermost-server/blob/release-5.2/model/gitlab/gitlab.go#L60 (json decoding) is failing:
func gitLabUserFromJson(data io.Reader) *GitLabUser {
decoder := json.NewDecoder(data)
var glu GitLabUser
err := decoder.Decode(&glu)
if err == nil {
return &glu
} else {
return nil
}
}
Actually I'm not a gopher, so my first best guess was the missing login
field in json decoding. But after modifying resource.php
adding a login
entry, the error did not disappear.
Commit 502ae7ecb4ca9ffd93b558185f575f64407ad95a works with mattermost 4.8.0 and 5.2.0.
Two test servers here. One with Mattermost 5.2.2 and one with 5.5.2. Same problem on both servers. Saw this https://github.com/mattermost/mattermost-server/issues/9960 and patch in 5.5.2 https://github.com/mattermost/mattermost-server/commit/0e31263320bd4c547de430e9291e91fe635c71d0 . Seems there is something wrong. Anyone? How to fix this?
Log of Mattermost 5.5.2:
{"level":"error","ts":1547454283.9044385,"caller":"app/server.go:60","msg":"Please check the std error output for the stack trace"} {"level":"error","ts":1547454283.9044843,"caller":"app/server.go:61","msg":"runtime error: invalid memory address or nil pointer dereference"} goroutine 3713 [running]: runtime/debug.Stack(0xc002aefe90, 0xe65a04, 0xc00333d280) /usr/local/go/src/runtime/debug/stack.go:24 +0xa7 runtime/debug.PrintStack() /usr/local/go/src/runtime/debug/stack.go:16 +0x22 github.com/mattermost/mattermost-server/vendor/github.com/gorilla/handlers.recoveryHandler.log(0x1572440, 0xc0001e2d90, 0x1572180, 0x20a0700, 0x1, 0xc002a5d770, 0x1, 0x1) /home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/vendor/github.com/gorilla/handlers/recovery.go:89 +0x71 github.com/mattermost/mattermost-server/vendor/github.com/gorilla/handlers.recoveryHandler.ServeHTTP.func1(0x157d320, 0xc0019aec40, 0x1572440, 0xc0001e2d90, 0x1572180, 0x20a0700, 0x1) /home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/vendor/github.com/gorilla/handlers/recovery.go:74 +0xda panic(0x118eae0, 0x2044030) /usr/local/go/src/runtime/panic.go:513 +0x1b9 github.com/mattermost/mattermost-server/model/gitlab.(*GitLabUser).IsValid(...) /home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/model/gitlab/gitlab.go:78 github.com/mattermost/mattermost-server/model/gitlab.(*GitLabProvider).GetUserFromJson(0x20a0700, 0x7ff710627f20, 0xc00336db00, 0x6) /home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/model/gitlab/gitlab.go:95 +0x3a github.com/mattermost/mattermost-server/app.(*App).CreateOAuthUser(0xc0000e8580, 0xc0000d446c, 0x6, 0x7ff710627f20, 0xc00336db00, 0x0, 0x0, 0xc000231568, 0xc000231560) /home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/app/user.go:262 +0x142 github.com/mattermost/mattermost-server/app.(*App).CompleteOAuth(0xc0000e8580, 0xc0000d446c, 0x6, 0x1578480, 0xc00336db00, 0x0, 0x0, 0xc002c177a0, 0x0, 0x0) /home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/app/oauth.go:505 +0x1e5 github.com/mattermost/mattermost-server/api4.completeOAuth(0xc002573300, 0x157d320, 0xc0019aec40, 0xc002573200) /home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/api4/oauth.go:501 +0xc4d github.com/mattermost/mattermost-server/web.Handler.ServeHTTP(0xc0000e8580, 0x13a9de0, 0x0, 0x157d320, 0xc0019aec40, 0xc002573200) /home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/web/handlers.go:131 +0x1343 github.com/mattermost/mattermost-server/vendor/github.com/gorilla/mux.(*Router).ServeHTTP(0xc0001e2d90, 0x157d320, 0xc0019aec40, 0xc002573200) /home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/vendor/github.com/gorilla/mux/mux.go:162 +0xf1 github.com/mattermost/mattermost-server/vendor/github.com/gorilla/handlers.recoveryHandler.ServeHTTP(0x1572440, 0xc0001e2d90, 0x1572180, 0x20a0700, 0x1, 0x157d320, 0xc0019aec40, 0xc002573000) /home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/vendor/github.com/gorilla/handlers/recovery.go:78 +0xb0 net/http.serverHandler.ServeHTTP(0xc002bfaf70, 0x157d320, 0xc0019aec40, 0xc002573000) /usr/local/go/src/net/http/server.go:2741 +0xab net/http.(*conn).serve(0xc003939c20, 0x157e1e0, 0xc0039a1780) /usr/local/go/src/net/http/server.go:1847 +0x646 created by net/http.(*Server).Serve /usr/local/go/src/net/http/server.go:2851 +0x2f5
5.7.1 works fine here after I uncommented resource.php to use this "old" version..
// Below is the old version, still consistent with Mattermost before version 4.4
$resp = array("name" => $data['cn'],"username" => $user,"id" => $assoc_id,"state" => "active","email" => $data['mail']);
Installed 5.7.1, does not work here :-(
@hekeli: It's really working at your installation with Mattermost 5.7.1? Can you share your configuration files with me? Can't get it working with 5.7.1 or 5.8.0. I have it installed on Debian 8 here.
@gharms80 Yes latest master version of Mattermost-LDAP and Mattermost 5.7.1 open source edition. Nothing needed except changing $resp described above, then it won't die on nil pointer. RedHat 7.
This issue should be resolved by the pull request #26, so I close it. Feel free to reopen it if you still have the error.
Thank you for your feedbacks,
I've installed the newest mattermost, and I got the following error, when I try to login with "gitlab" . I guess mattermost is missing some data from the oauth server response, but i couldn't figure it out.
Mattermost Version: 5.2.1 Database Schema Version: 5.2.0 Database: mysql