Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix heavy regression on GitLab for version 3.0.0 #3000

Merged
merged 1 commit into from
May 16, 2016

Conversation

ArthurHlt
Copy link
Contributor

Hello there,
First, thanks for the work made on mattermost.

I found on new release 3.0.0 an heavy regression on SSO with gitlab, when I was trying to connect to it i get this stacktrace:

2016/05/14 16:25:54 runtime error: invalid memory address or nil pointer dereference
goroutine 16 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
/usr/local/go/src/runtime/debug/stack.go:24 +0x80
runtime/debug.PrintStack()
/usr/local/go/src/runtime/debug/stack.go:16 +0x18
github.com/gorilla/handlers.recoveryHandler.log(0x7f064598d840, 0xc8202bfbc0, 0x0, 0x1, 0xca20c0, 0xc82000a0b0)
/var/lib/jenkins/jobs/mattermost-platform-release/workspace/src/github.com/mattermost/platform/Godeps/_workspace/src/github.com/gorilla/handlers/recovery.go:84 +0xb8
github.com/gorilla/handlers.recoveryHandler.ServeHTTP.func1(0x7f06459d4710, 0xc820323c70, 0x7f064598d840, 0xc8202bfbc0, 0x0, 0xc82038c101)
/var/lib/jenkins/jobs/mattermost-platform-release/workspace/src/github.com/mattermost/platform/Godeps/_workspace/src/github.com/gorilla/handlers/recovery.go:69 +0x9b
panic(0xca20c0, 0xc82000a0b0)
/usr/local/go/src/runtime/panic.go:443 +0x4e9
github.com/mattermost/platform/model/gitlab.userFromGitLabUser(0xc8207f87d0, 0xc82026d9c0)
/var/lib/jenkins/jobs/mattermost-platform-release/workspace/src/github.com/mattermost/platform/model/gitlab/gitlab.go:50 +0x2a9
github.com/mattermost/platform/model/gitlab.(*GitLabProvider).GetUserFromJson(0x11eb358, 0x7f06459a0a40, 0xc82026d9c0, 0x6)
/var/lib/jenkins/jobs/mattermost-platform-release/workspace/src/github.com/mattermost/platform/model/gitlab/gitlab.go:90 +0x4c

This stack trace is relative how the code deal with pointer.
And what I found is that you trying to pass a value to a pointer which is not initialized, so the compiler is not complaining because it doesn't check if pointers are initialized in a struct.

So, I did a small fix for a small bug which break everything. I hope it will help

Hello there, 
First, thanks for the work made on mattermost.

I found on new release 3.0.0 an heavy regression on SSO with gitlab, when I was trying to connect to it i get this stacktrace:

```
2016/05/14 16:25:54 runtime error: invalid memory address or nil pointer dereference
goroutine 16 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
/usr/local/go/src/runtime/debug/stack.go:24 +0x80
runtime/debug.PrintStack()
/usr/local/go/src/runtime/debug/stack.go:16 +0x18
github.com/gorilla/handlers.recoveryHandler.log(0x7f064598d840, 0xc8202bfbc0, 0x0, 0x1, 0xca20c0, 0xc82000a0b0)
/var/lib/jenkins/jobs/mattermost-platform-release/workspace/src/github.com/mattermost/platform/Godeps/_workspace/src/github.com/gorilla/handlers/recovery.go:84 +0xb8
github.com/gorilla/handlers.recoveryHandler.ServeHTTP.func1(0x7f06459d4710, 0xc820323c70, 0x7f064598d840, 0xc8202bfbc0, 0x0, 0xc82038c101)
/var/lib/jenkins/jobs/mattermost-platform-release/workspace/src/github.com/mattermost/platform/Godeps/_workspace/src/github.com/gorilla/handlers/recovery.go:69 +0x9b
panic(0xca20c0, 0xc82000a0b0)
/usr/local/go/src/runtime/panic.go:443 +0x4e9
github.com/mattermost/platform/model/gitlab.userFromGitLabUser(0xc8207f87d0, 0xc82026d9c0)
/var/lib/jenkins/jobs/mattermost-platform-release/workspace/src/github.com/mattermost/platform/model/gitlab/gitlab.go:50 +0x2a9
github.com/mattermost/platform/model/gitlab.(*GitLabProvider).GetUserFromJson(0x11eb358, 0x7f06459a0a40, 0xc82026d9c0, 0x6)
/var/lib/jenkins/jobs/mattermost-platform-release/workspace/src/github.com/mattermost/platform/model/gitlab/gitlab.go:90 +0x4c
```

This stack trace is relative how the code deal with pointer.
And what I found is that you trying to pass a value to a pointer which is not initialized, so the compiler is not complaining because it doesn't check if pointers are initialized in a struct.

So, I did a small fix for a small bug which break everything. I hope it will help
@it33
Copy link
Contributor

it33 commented May 14, 2016

Thanks @ArthurHlt! Highly appreciated, will look into this,

@ArthurHlt
Copy link
Contributor Author

@it33 You're welcome

@@ -47,7 +47,8 @@ func userFromGitLabUser(glu *GitLabUser) *model.User {
}
strings.TrimSpace(user.Email)
user.Email = glu.Email
*user.AuthData = strconv.FormatInt(glu.Id, 10)
Copy link
Contributor Author

@ArthurHlt ArthurHlt May 14, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here user is created with &model.User{} and have AuthData which is a pointer on a string.
But the default of a pointer is nil, no memory is allocated and it's not pointing to an address and in this part of the code it tries to put the value from strconv.FormatInt(glu.Id, 10) in the memory where the address inside AuthData pointed which is nil.

@it33
Copy link
Contributor

it33 commented May 15, 2016

Thanks @ArthurHlt, we're trying to get in touch with the people who can review and commit this and cut a 3.0.1 before May 16. We'll make sure to fix this before it goes into GitLab omnibus on May 22

@ArthurHlt
Copy link
Contributor Author

@it33 ok no problem, thank you

@coreyhulen
Copy link
Contributor

+1

1 similar comment
@jwilander
Copy link
Member

+1

@jwilander jwilander added 4: Reviews Complete All reviewers have approved the pull request and removed Needs Seconder labels May 16, 2016
@crspeller crspeller merged commit 7fa7bee into mattermost:master May 16, 2016
crspeller pushed a commit that referenced this pull request May 16, 2016
@ArthurHlt ArthurHlt deleted the fix-gitlab-regression branch May 16, 2016 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4: Reviews Complete All reviewers have approved the pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants