Mattermost-push-proxy panic


#1

I’ve got v3.5 of the push proxy server running with v3.6.2 platform. Works fine after spending some amount of time getting everything right. However, I am seeing sporadic panics in the proxy server:

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

goroutine 40 [running]:
panic(0x6b7c00, 0xc42000c050)
/usr/local/go/src/runtime/panic.go:500 +0x1a1
github.com/mattermost/mattermost-push-proxy/server.sendAppleNotification(0xc42043ab00)

There does not seem to be an issues tracker for this Github project so I cannot open a ticket with the info. I’ll try and investigate a solution though I’m a Go beginner. Is there a place where I should report this besides here?

Brad


#2

Also, is there a way to have a notification sent by default instead of only if @all or @channel are present? We can get around this by programmatically doing this, but if there is something already available that would be great. A quick scan of the notification.go code appears to answer “no” to this.

Brad


#3

So, the problem with the panic is that in the code (server.go) there is a check for an error from the apns.Client instance, but then there is a blind check on the result object which may be null:

if err != nil {
	LogError(fmt.Sprintf("Failed to send apple push sid=%v did=%v err=%v", msg.ServerId, msg.DeviceId, err))
} 
if !res.Sent() {
	LogError(fmt.Sprintf("Failed to send apple push with res ApnsID=%v reason=%v code=%v", res.ApnsID, res.Reason, res.StatusCode))
}

This really should be an else if or a check for a null res value (or both). Also, once there is an error I think the apns.Client instance is toast and should be recreated. Not positive on this, but it works for me right now and my proxy is no longer falling over when there is a lull in the notification traffic.


#4

This is fixed with 3.7.1 of push proxy.


#5

I’ve been trying to configure push-proxy on my server.i have done complete installation from here


After installation my server is running but when i want to test notification from curl

curl http://172.104.182.36:8066/api/v1/send_push -X POST -H "Content-Type: application/json" -d '{ "message":"test", "badge": 1, "platform":"android", "server_id":"c5brhfxaeb8o3qkcc3dfc47coy", "device_id":"android:el99uTDjv0A:APA91bGnVbuZl9W2lQSSokXYECVa4Tgt-wrnOxQFh4r51pzdDaFxbXUrJXQgmcSaPYToyIA5Dc9CCLPvYPNBF8bnrZdCjOSIaJmgB0Uhusj-8IoVCtFfAkF_l_PfRq0TMQf7L_RYMLqo"}'

I got this error:
{"error":"unknown transport error","status":"FAIL"}

please help me


#6

Hi @vipinbimt,

Thank you for your question,

You might find the help you’re looking for in this set-up guide