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

nil pointer dereference error/panic when writing back to S3 #52

Open
NOP64 opened this issue Oct 5, 2021 · 1 comment · May be fixed by #78
Open

nil pointer dereference error/panic when writing back to S3 #52

NOP64 opened this issue Oct 5, 2021 · 1 comment · May be fixed by #78

Comments

@NOP64
Copy link

NOP64 commented Oct 5, 2021

Summary

I can edit a document but saving the changes generates a nil pointer dereference. Visually, there is no message to that effect leading someone to falsely believe that the update was successful.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Upload document in Mattermost.
  2. Open document.
  3. Hit "enable editing".
  4. Make a change.
  5. Hit floppy icon to save changes.
  6. Observe error in mattermost.log

Expected behavior

Visible error (at least) or successfully saved document.

Observed Behavior (that appears unintentional)

Nothing. It silently fails.

Screenshots

See Mattermost channel conversation starting at https://community-daily.mattermost.com/core/pl/pockesygapr35pwo1y6zzi5bho for more details.

Possible fixes

If you can, link to the line of code that might be responsible for the problem.

Masttermost log file entry

{                                                                                                                                                                                                           [673/829]
  "level": "error",
  "ts": 1632883917.8644838,
  "caller": "mlog/sugar.go:25",
  "msg": "Recovered from a panic",
  "plugin_id": "com.collaboraonline.mattermost",
  "url": "/api/v1/wopi/files/z1hb5ckewi8r5r9te48ztgfr6c/edit/contents?access_token_ttl=0&reuse_cookies=rl_anonymous_id%3D%22b861b965-8cc8-4878-83e9-9dac1b8f0b35%22%3Arl_user_id%3D%22%22",
  "error": "runtime error: invalid memory address or nil pointer dereference",
  "stack": "goroutine 14 [running]:\nruntime/debug.Stack(0xc0002f8120, 0xc000352160, 0xaf)\n\t/opt/local/lib/go/src/runtime/debug/stack.go:24 +0x9f\nmain.(*Plugin).withRecovery.func1.1(0xc000480ae0, 0xc000428300)\
n\t/Users/mark/src/collabora-mattermost/server/api.go:70 +0x85\npanic(0xf04fa0, 0x179cd10)\n\t/opt/local/lib/go/src/runtime/panic.go:965 +0x1b9\ngithub.com/mattermost/mattermost-server/v5/model.(*FileSettings).ToF
ileBackendSettings(0xc0003d2670, 0xc0003d2001, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)\n\t/Users/mark/go/pkg/mod/github.com/mattermost/mattermost-server/[email protected]/model/config.go:1522 +0x16a\nmain.(*Plugin).
getFileBackend(0xc000480ae0, 0x7fc2da28b2c0, 0xc0005155f8, 0x40b925, 0xf176c0)\n\t/Users/mark/src/collabora-mattermost/server/utils.go:16 +0xaf\nmain.(*Plugin).WriteFile(0xc000480ae0, 0x7fc2da28b2c0, 0xc0005ca3a0,
 0xc00013c3f0, 0x84, 0xc0002c28c0, 0x1, 0xc00097e140)\n\t/Users/mark/src/collabora-mattermost/server/utils.go:24 +0x2f\nmain.(*Plugin).saveWopiFileContents(0xc000480ae0, 0x11dd410, 0xc00052e0a0, 0xc000428300)\n\t/
Users/mark/src/collabora-mattermost/server/api.go:421 +0x4be\nnet/http.HandlerFunc.ServeHTTP(0xc000875230, 0x11dd410, 0xc00052e0a0, 0xc000428300)\n\t/opt/local/lib/go/src/net/http/server.go:2049 +0x44\nmain.(*Plug
in).withRecovery.func1(0x11dd410, 0xc00052e0a0, 0xc000428300)\n\t/Users/mark/src/collabora-mattermost/server/api.go:74 +0x82\nnet/http.HandlerFunc.ServeHTTP(0xc000962000, 0x11dd410, 0xc00052e0a0, 0xc000428300)\n\t
/opt/local/lib/go/src/net/http/server.go:2049 +0x44\ngithub.com/gorilla/mux.(*Router).ServeHTTP(0xc0009e6000, 0x11dd410, 0xc00052e0a0, 0xc0009fc200)\n\t/Users/mark/go/pkg/mod/github.com/gorilla/[email protected]/mux.go:2
10 +0xd3\nmain.(*Plugin).ServeHTTP(0xc000480ae0, 0xc0009ea7e0, 0x11dd410, 0xc00052e0a0, 0xc0009fc200)\n\t/Users/mark/src/collabora-mattermost/server/plugin.go:67 +0x1cb\ngithub.com/mattermost/mattermost-server/v5/
plugin.(*hooksRPCServer).ServeHTTP(0xc0003506a0, 0xc0005c2040, 0x17ea4e8, 0x0, 0x0)\n\t/Users/mark/go/pkg/mod/github.com/mattermost/mattermost-server/[email protected]/plugin/client_rpc.go:447 +0x2af\nreflect.Value.call(
0xc0004dc5a0, 0xc0004d41e0, 0x13, 0x1035158, 0x4, 0xc000791f08, 0x3, 0x3, 0x405c01, 0xc0005ce1b0, ...)\n\t/opt/local/lib/go/src/reflect/value.go:476 +0x8e7\nreflect.Value.Call(0xc0004dc5a0, 0xc0004d41e0, 0x13, 0xc
000491708, 0x3, 0x3, 0x67eb93, 0xc00037ea80, 0x0)\n\t/opt/local/lib/go/src/reflect/value.go:337 +0xb9\nnet/rpc.(*service).call(0xc0004de000, 0xc0004d20f0, 0xc0004d6090, 0xc0004d60a0, 0xc000422780, 0xc00041c260, 0x
e725a0, 0xc0005c2040, 0x16, 0xe86ee0, ...)\n\t/opt/local/lib/go/src/net/rpc/server.go:377 +0x189\ncreated by net/rpc.(*Server).ServeCodec\n\t/opt/local/lib/go/src/net/rpc/server.go:474 +0x44d\n"
}

Stack trace expanded

goroutine 14 [running]:
runtime/debug.Stack(0xc0002f8120, 0xc000352160, 0xaf)
	/opt/local/lib/go/src/runtime/debug/stack.go:24 +0x9f
main.(*Plugin).withRecovery.func1.1(0xc000480ae0, 0xc000428300)
	/Users/mark/src/collabora-mattermost/server/api.go:70 +0x85
panic(0xf04fa0, 0x179cd10)
	/opt/local/lib/go/src/runtime/panic.go:965 +0x1b9
github.com/mattermost/mattermost-server/v5/model.(*FileSettings).ToFileBackendSettings(0xc0003d2670, 0xc0003d2001, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/Users/mark/go/pkg/mod/github.com/mattermost/mattermost-server/[email protected]/model/config.go:1522 +0x16a
main.(*Plugin).getFileBackend(0xc000480ae0, 0x7fc2da28b2c0, 0xc0005155f8, 0x40b925, 0xf176c0)
	/Users/mark/src/collabora-mattermost/server/utils.go:16 +0xaf
main.(*Plugin).WriteFile(0xc000480ae0, 0x7fc2da28b2c0, 0xc0005ca3a0, 0xc00013c3f0, 0x84, 0xc0002c28c0, 0x1, 0xc00097e140)
	/Users/mark/src/collabora-mattermost/server/utils.go:24 +0x2f
main.(*Plugin).saveWopiFileContents(0xc000480ae0, 0x11dd410, 0xc00052e0a0, 0xc000428300)
	/Users/mark/src/collabora-mattermost/server/api.go:421 +0x4be
net/http.HandlerFunc.ServeHTTP(0xc000875230, 0x11dd410, 0xc00052e0a0, 0xc000428300)
	/opt/local/lib/go/src/net/http/server.go:2049 +0x44
main.(*Plugin).withRecovery.func1(0x11dd410, 0xc00052e0a0, 0xc000428300)
	/Users/mark/src/collabora-mattermost/server/api.go:74 +0x82
net/http.HandlerFunc.ServeHTTP(0xc000962000, 0x11dd410, 0xc00052e0a0, 0xc000428300)
	/opt/local/lib/go/src/net/http/server.go:2049 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc0009e6000, 0x11dd410, 0xc00052e0a0, 0xc0009fc200)
	/Users/mark/go/pkg/mod/github.com/gorilla/[email protected]/mux.go:210 +0xd3
main.(*Plugin).ServeHTTP(0xc000480ae0, 0xc0009ea7e0, 0x11dd410, 0xc00052e0a0, 0xc0009fc200)
	/Users/mark/src/collabora-mattermost/server/plugin.go:67 +0x1cb
github.com/mattermost/mattermost-server/v5/plugin.(*hooksRPCServer).ServeHTTP(0xc0003506a0, 0xc0005c2040, 0x17ea4e8, 0x0, 0x0)
	/Users/mark/go/pkg/mod/github.com/mattermost/mattermost-server/[email protected]/plugin/client_rpc.go:447 +0x2af
reflect.Value.call(0xc0004dc5a0, 0xc0004d41e0, 0x13, 0x1035158, 0x4, 0xc000791f08, 0x3, 0x3, 0x405c01, 0xc0005ce1b0, ...)
	/opt/local/lib/go/src/reflect/value.go:476 +0x8e7
reflect.Value.Call(0xc0004dc5a0, 0xc0004d41e0, 0x13, 0xc000491708, 0x3, 0x3, 0x67eb93, 0xc00037ea80, 0x0)
	/opt/local/lib/go/src/reflect/value.go:337 +0xb9
net/rpc.(*service).call(0xc0004de000, 0xc0004d20f0, 0xc0004d6090, 0xc0004d60a0, 0xc000422780, 0xc00041c260, 0xe725a0, 0xc0005c2040, 0x16, 0xe86ee0, ...)
	/opt/local/lib/go/src/net/rpc/server.go:377 +0x189
created by net/rpc.(*Server).ServeCodec
	/opt/local/lib/go/src/net/rpc/server.go:474 +0x44d

Environment

  • Mattermost version: 5.39
  • OS: Linux
  • Platform: macOS desktop app and browser
  • Browser (if applicable): Firefox
  • Platform Version: e.g. 68
  • Collabora Docker image collabora/code created on 2021-09-20T18:12:42.928787763Z
  • Compiled latest code from GitHub.
@availchet availchet linked a pull request Mar 13, 2023 that will close this issue
2 tasks
@availchet
Copy link
Contributor

availchet commented Mar 13, 2023

@NOP64 Could you test again with changes from #78
It has some fixes for using the new file backend API, which might be related to your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants