SherClockHolmes / webpush-go

Web Push API Encryption with VAPID support.
MIT License
312 stars 67 forks source link

panic on pad #27

Closed danf0rth closed 4 years ago

danf0rth commented 5 years ago

In some cases the panic occurred when called SendNotification method.

go version go1.12.1 linux/amd64 also tried go version go1.12.5 linux/amd64

runtime.gopanic
        /usr/local/go/src/runtime/panic.go:522
runtime.panicmakeslicelen
        /usr/local/go/src/runtime/slice.go:27
runtime.makeslice
        /usr/local/go/src/runtime/slice.go:44
github.com/SherClockHolmes/webpush-go.pad
        /home/danforth/Dev/go/pkg/mod/github.com/!sher!clock!holmes/webpush-go@v1.1.0/webpush.go:250
github.com/SherClockHolmes/webpush-go.SendNotification
        /home/danforth/Dev/go/pkg/mod/github.com/!sher!clock!holmes/webpush-go@v1.1.0/webpush.go:169
gbhrdt commented 5 years ago

I think I've seen something similar when using a too big payload.

danf0rth commented 5 years ago

@gbhrdt yes, just yesterday we tried to reduce our payloads and bug is gone. Today we try to increase payload again and the problem still not appears, moreover, our payloads now is even bigger then before, when the panic occurs, but the problem is gone and everything works fine. I not sure, maybe the problem was in header

pierrre commented 4 years ago

I also have this issue:

For now, I will defer/recover the panic in my code.