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

Client.Push may panic #131

Closed
pshopper opened this issue Apr 22, 2019 · 7 comments
Closed

Client.Push may panic #131

pshopper opened this issue Apr 22, 2019 · 7 comments

Comments

@pshopper
Copy link
Contributor

Add error check on http request creation in

apns2/client.go

Line 157 in d5157a5

req, _ := http.NewRequest("POST", url, bytes.NewBuffer(payload))

and return err.

@pshopper pshopper changed the title Client.Push panic Client.Push may panic Apr 22, 2019
@sideshow
Copy link
Owner

Thanks @pshopper can you please provide more information such as the stack trace

@pshopper
Copy link
Contributor Author

pshopper commented Apr 25, 2019

@sideshow

runtime.errorString: runtime error: invalid memory address or nil pointer dereference
  File "runtime/panic.go", line 489, in gopanic
    reflectcall(nil, unsafe.Pointer(d.fn), deferArgs(d), uint32(d.siz), uint32(d.siz))
  File "runtime/panic.go", line 63, in panicmem
    panic(memoryError)
  File "runtime/signal_unix.go", line 290, in sigpanic
    panicmem()
  File "server/vendor/github.com/sideshow/apns2/client.go", line 195, in setHeaders
    r.Header.Set("Content-Type", "application/json; charset=utf-8")
  File "server/vendor/github.com/sideshow/apns2/client.go", line 163, in PushWithContext
    setHeaders(req, n)
  File "server/vendor/github.com/sideshow/apns2/client.go", line 138, in Push
    return c.PushWithContext(nil, n)
  File "server/apple.go", line 248, in spawnWorker
    resp, err = client.Push(n)
  File "<autogenerated>", line 29, in spawnWorker
  File "server/delivery_provider.go", line 29, in func1
    d.spawnWorker(workerName, pm)
  File "server/vendor/github.com/getsentry/raven-go/client.go", line 753, in CapturePanic
    f()
  File "server/vendor/github.com/getsentry/raven-go/client.go", line 760, in CapturePanic
    return DefaultClient.CapturePanic(f, tags, interfaces...)

@pshopper
Copy link
Contributor Author

It appear after set bad device token

@pshopper
Copy link
Contributor Author

@sideshow
Maybe I will make PR?

@sideshow
Copy link
Owner

Thanks for logging this. Yes please, a PR would be great

@pshopper
Copy link
Contributor Author

pshopper commented May 16, 2019

@sideshow, please, look at my PR fix(panic) fix client push panic

@sideshow
Copy link
Owner

sideshow commented Sep 7, 2019

Fixed via #134

@sideshow sideshow closed this as completed Sep 7, 2019
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

No branches or pull requests

2 participants