Mattermost-server: Unable to delete team (SIGSEGV)

Created on 2 May 2017  Â·  12Comments  Â·  Source: mattermost/mattermost-server

Summary

I'm unable to delete team, I get SIGSEGV

Steps to reproduce

  1. Enable Matteromost in GitLab
  2. Start configuting Mattermost and accidentaly create new team
  3. Try to delete the (empty) team: sudo -u mattermost /opt/gitlab/embedded/bin/mattermost --config=/var/opt/gitlab/mattermost/config.json team delete android --confirm

Expected behavior

Team gets deleted.

Observed behavior

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xbf7f38]

goroutine 1 [running]:
main.getTeamFromTeamArg(0x7ffeb41db652, 0x7, 0x1)
    /home/ubuntu/workspace/msr/d/platform-release/src/github.com/mattermost/platform/cmd/platform/teamargs.go:21 +0x28
main.getTeamsFromTeamArgs(0xc420134240, 0x1, 0x3, 0xae6901, 0x0, 0x0)
    /home/ubuntu/workspace/msr/d/platform-release/src/github.com/mattermost/platform/cmd/platform/teamargs.go:13 +0xa2
main.deleteTeamsCmdF(0x11a39e0, 0xc420134240, 0x1, 0x3, 0x0, 0x0)
    /home/ubuntu/workspace/msr/d/platform-release/src/github.com/mattermost/platform/cmd/platform/team.go:186 +0xc1
github.com/mattermost/platform/vendor/github.com/spf13/cobra.(*Command).execute(0x11a39e0, 0xc4201341b0, 0x3, 0x3, 0x11a39e0, 0xc4201341b0)
    /home/ubuntu/workspace/msr/d/platform-release/src/github.com/mattermost/platform/vendor/github.com/spf13/cobra/command.go:643 +0x3ef
github.com/mattermost/platform/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc4200906c0, 0x0, 0x0, 0x0)
    /home/ubuntu/workspace/msr/d/platform-release/src/github.com/mattermost/platform/vendor/github.com/spf13/cobra/command.go:734 +0x339
github.com/mattermost/platform/vendor/github.com/spf13/cobra.(*Command).Execute(0xc4200906c0, 0xc42011a930, 0xb)
    /home/ubuntu/workspace/msr/d/platform-release/src/github.com/mattermost/platform/vendor/github.com/spf13/cobra/command.go:692 +0x2b
main.main()
    /home/ubuntu/workspace/msr/d/platform-release/src/github.com/mattermost/platform/cmd/platform/mattermost.go:50 +0x4b2

Most helpful comment

Okay, I think I've got it. The i18n files are in /opt/gitlab/embedded/service/mattermost, so if you cd into there and run sudo -u mattermost /opt/gitlab/embedded/bin/mattermost --config=/var/opt/gitlab/mattermost/config.json team delete android --confirm, it will delete the team

All 12 comments

Hi @Pitel,

Can you try running it from /opt/gitlab/embedded as sudo -u mattermost ./bin/mattermost ...? We've had reports of issues when Mattermost isn't ran with that path.

https://mattermost.atlassian.net/browse/PLT-6463

Same SIGSEGV:

➜  embedded sudo -u mattermost ./bin/mattermost --config=/var/opt/gitlab/mattermost/config.json team delete android --confirm
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xbf7f38]

goroutine 1 [running]:
main.getTeamFromTeamArg(0x7ffc6a38d678, 0x7, 0x1)
    /home/ubuntu/workspace/msr/d/platform-release/src/github.com/mattermost/platform/cmd/platform/teamargs.go:21 +0x28
main.getTeamsFromTeamArgs(0xc42001c240, 0x1, 0x3, 0xae6901, 0x0, 0x0)
    /home/ubuntu/workspace/msr/d/platform-release/src/github.com/mattermost/platform/cmd/platform/teamargs.go:13 +0xa2
main.deleteTeamsCmdF(0x11a39e0, 0xc42001c240, 0x1, 0x3, 0x0, 0x0)
    /home/ubuntu/workspace/msr/d/platform-release/src/github.com/mattermost/platform/cmd/platform/team.go:186 +0xc1
github.com/mattermost/platform/vendor/github.com/spf13/cobra.(*Command).execute(0x11a39e0, 0xc42001c1b0, 0x3, 0x3, 0x11a39e0, 0xc42001c1b0)
    /home/ubuntu/workspace/msr/d/platform-release/src/github.com/mattermost/platform/vendor/github.com/spf13/cobra/command.go:643 +0x3ef
github.com/mattermost/platform/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc4200a66c0, 0x0, 0x0, 0x0)
    /home/ubuntu/workspace/msr/d/platform-release/src/github.com/mattermost/platform/vendor/github.com/spf13/cobra/command.go:734 +0x339
github.com/mattermost/platform/vendor/github.com/spf13/cobra.(*Command).Execute(0xc4200a66c0, 0xc4201388b0, 0xb)
    /home/ubuntu/workspace/msr/d/platform-release/src/github.com/mattermost/platform/vendor/github.com/spf13/cobra/command.go:692 +0x2b
main.main()
    /home/ubuntu/workspace/msr/d/platform-release/src/github.com/mattermost/platform/cmd/platform/mattermost.go:50 +0x4b2

Also same when I try it from bin directory.

Okay, so it's not that. Do you get the same error if you do a simpler command like the version command? It looks like we're swallowing some errors which might make this difficult to debug

sudo -u mattermost /opt/gitlab/embedded/bin/mattermost --config=/var/opt/gitlab/mattermost/config.json version

Pretty much, yeah:

➜  ~ sudo -u mattermost /opt/gitlab/embedded/bin/mattermost --config=/var/opt/gitlab/mattermost/config.json version                      
[sudo] password for kalab: 
Version: 3.7.0
Build Number: 3.7.3
Build Date: Wed Mar 22 23:31:00 UTC 2017
Build Hash: 8ec37570742b67fd640bb3434ea226c655dbf408
Build Enterprise Ready: false
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xbfc2c6]

goroutine 1 [running]:
main.printVersion()
    /home/ubuntu/workspace/msr/d/platform-release/src/github.com/mattermost/platform/cmd/platform/version.go:29 +0x3f6
main.versionCmdF(0x11a57a0, 0xc42011a9e0, 0x0, 0x1)
    /home/ubuntu/workspace/msr/d/platform-release/src/github.com/mattermost/platform/cmd/platform/version.go:20 +0x30
github.com/mattermost/platform/vendor/github.com/spf13/cobra.(*Command).execute(0x11a57a0, 0xc42011a980, 0x1, 0x1, 0x11a57a0, 0xc42011a980)
    /home/ubuntu/workspace/msr/d/platform-release/src/github.com/mattermost/platform/vendor/github.com/spf13/cobra/command.go:647 +0x231
github.com/mattermost/platform/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc4200906c0, 0x0, 0x0, 0x0)
    /home/ubuntu/workspace/msr/d/platform-release/src/github.com/mattermost/platform/vendor/github.com/spf13/cobra/command.go:734 +0x339
github.com/mattermost/platform/vendor/github.com/spf13/cobra.(*Command).Execute(0xc4200906c0, 0xc42011a920, 0xb)
    /home/ubuntu/workspace/msr/d/platform-release/src/github.com/mattermost/platform/vendor/github.com/spf13/cobra/command.go:692 +0x2b
main.main()
    /home/ubuntu/workspace/msr/d/platform-release/src/github.com/mattermost/platform/cmd/platform/mattermost.go:50 +0x4b2

Perhaps you could try cding into /opt/mattermost and running it as bin/platform from there? I'm going through all the reports we've had of similar issues here and I think it's caused by Mattermost being unable to find the i18n directory (which should be /opt/mattermost/i18n) and then not failing gracefully

There is no /opt/mattermost/ :(

It must be somewhere else then. I assume /opt/gitlab/embedded/bin/mattermost is a symbolic link to wherever Mattermost is actually located, so can you use something ls -l /opt/gitlab/embedded/bin/mattermost to see where it's pointing to? When you find that, you should be able to go to that directory and run the Mattermost CLI from there

It's not symlink:

➜  bin pwd
/opt/gitlab/embedded/bin
➜  bin ll mattermost
-rwxr-xr-x 1 root root 21M  1. kvě 14.43 mattermost
➜  bin file mattermost 
mattermost: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), not stripped

The system is CentOS (7, i think) with GitLab installed from repository with yum.

Okay, I think I've got it. The i18n files are in /opt/gitlab/embedded/service/mattermost, so if you cd into there and run sudo -u mattermost /opt/gitlab/embedded/bin/mattermost --config=/var/opt/gitlab/mattermost/config.json team delete android --confirm, it will delete the team

Yup, now it works. Thanks! :tada:

Should we close it, or keep it open so it'll remind you to somehow fix it? :)

Glad I could help! I think we can close this issue. We already have https://mattermost.atlassian.net/browse/PLT-6463 tracking the problem

Was this page helpful?
0 / 5 - 0 ratings