Giter Site home page Giter Site logo

Out of memory about pushnotification HOT 15 CLOSED

edujugon avatar edujugon commented on August 14, 2024
Out of memory

from pushnotification.

Comments (15)

danielz0 avatar danielz0 commented on August 14, 2024 1

Hi @Edujugon,
Didn't have time to test this in php7.1.4 nor in 7.0.18, but will do it next week, as I plan to update at least one of my servers. For now I am using self-written script which chunks data into smaller sets.

The payload which crashed in my case contains 1000tokens and one-two lines in the message body.

Best,
Daniel

from pushnotification.

Edujugon avatar Edujugon commented on August 14, 2024

Hi @efeferrari
Have you tried to test it in other environment?

from pushnotification.

efeferrari avatar efeferrari commented on August 14, 2024

I tried in local and development environments. In both, I set ini_set memory_limit to 1 GB.

from pushnotification.

Drozes avatar Drozes commented on August 14, 2024

Same issue, Any luck on finding a fix for this?

from pushnotification.

efeferrari avatar efeferrari commented on August 14, 2024

I try with a new iOS certificate and works fine, but it's still a bug get an "Out of memory" instead an "invalid certificate" 🤔

from pushnotification.

Edujugon avatar Edujugon commented on August 14, 2024

Hi @efeferrari @Drozes ,
I'm really busy these days and I'm not able to check out this issue.

For now, as @efeferrari said , you can generate a new certificate and try with it. It's not the first time that generating a new certificate solves some issues..

from pushnotification.

Dolaned avatar Dolaned commented on August 14, 2024

Hi also having this issue with a new cert, anyone find the issue?

from pushnotification.

Edujugon avatar Edujugon commented on August 14, 2024

Hi @gl3nda85 ,

Could you try to call apnsFeedback() method and see if it returns any token?
Notice that method returns a list of tokes that should be removed from the deviceToken list to send the notification.
Then, try again to send the notification.

Let me know if that helped

from pushnotification.

danielz0 avatar danielz0 commented on August 14, 2024

Hi Edujugon,
I am experiencing kind of the same error: when trying to send pushes to APN the php starts consume memory, freezes and at the end I got "PHP Fatal error: Allowed memory....".
The feedback() method is not even called because all freezes on send().

Any clue?

Best,
Daniel

Laravel 5.2, PHP 7.0

from pushnotification.

Edujugon avatar Edujugon commented on August 14, 2024

Hi @danielz0 ,

In the next days I'll dig deeply into this issue. Would you share your certificate with me so I could do tests with that one as well? if so, send me a mail to [email protected]

In the meantime, have you tried to generate a new Certificate? most probably is Apple who is refusing the connection to its server..

from pushnotification.

danielz0 avatar danielz0 commented on August 14, 2024

Hi again,
I am sorry to say, but the same certificate used on another server works totally fine.
I have traced this for errors and I am sure that
class Apn extends PushService implements PushServiceInterface
public function send(array $deviceTokens,array $message)
is the one which generates problem.

In details I have two servers with Laravel 5.2 and PHP7.0
Both were working fine, until one day one of it stopped sending iOS pushes.

After days of tracing the only thing I got is
Symfony\Component\Debug\Exception\FatalErrorException: Allowed memory size of 536870912 bytes exhausted (tried to allocate 20480 bytes) in /default/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:59

I have tried all tricks, from modules update to increasing memory limits - no luck so far.
When using strace I can see that the Apple push service returns 'operation in progress' all the time which increasing occupied memory and finally leads to memory exception.

Not sure, but personally I think it might be something connected with system libraries.

I am going to generate list of files your process is trying to open on both servers and compare.

Any suggestions are welcome.

Thanks!
Daniel

from pushnotification.

danielz0 avatar danielz0 commented on August 14, 2024

Maybe this will help you?

Strace:
[pid 27958] 19:53:56 recvmsg(12, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"\24\0\0\0\3\0\2\0\244\253\25Z6m\0\0\0\0\0\0", 4096}], msg_controllen=0, msg_flags=0}, 0) = 20 [pid 27958] 19:53:56 close(12) = 0 [pid 27958] 19:53:56 socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 12 [pid 27958] 19:53:56 connect(12, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("17.188.135.152")}, 16) = 0 [pid 27958] 19:53:56 getsockname(12, {sa_family=AF_INET, sin_port=htons(40476), sin_addr=inet_addr("46.101.111.122")}, [16]) = 0 [pid 27958] 19:53:56 connect(12, {sa_family=AF_UNSPEC, sa_data="\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}, 16) = 0 [pid 27958] 19:53:56 connect(12, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("17.188.129.28")}, 16) = 0 [pid 27958] 19:53:56 getsockname(12, {sa_family=AF_INET, sin_port=htons(56513), sin_addr=inet_addr("46.101.111.122")}, [16]) = 0 [pid 27958] 19:53:56 connect(12, {sa_family=AF_UNSPEC, sa_data="\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}, 16) = 0 [pid 27958] 19:53:56 connect(12, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("17.188.137.23")}, 16) = 0 [pid 27958] 19:53:56 getsockname(12, {sa_family=AF_INET, sin_port=htons(40665), sin_addr=inet_addr("46.101.111.122")}, [16]) = 0 [pid 27958] 19:53:56 connect(12, {sa_family=AF_UNSPEC, sa_data="\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}, 16) = 0 [pid 27958] 19:53:56 connect(12, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("17.188.135.148")}, 16) = 0 [pid 27958] 19:53:56 getsockname(12, {sa_family=AF_INET, sin_port=htons(59539), sin_addr=inet_addr("46.101.111.122")}, [16]) = 0 [pid 27958] 19:53:56 connect(12, {sa_family=AF_UNSPEC, sa_data="\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}, 16) = 0 [pid 27958] 19:53:56 connect(12, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("17.188.130.23")}, 16) = 0 [pid 27958] 19:53:56 getsockname(12, {sa_family=AF_INET, sin_port=htons(56115), sin_addr=inet_addr("46.101.111.122")}, [16]) = 0 [pid 27958] 19:53:56 connect(12, {sa_family=AF_UNSPEC, sa_data="\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}, 16) = 0 [pid 27958] 19:53:56 connect(12, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("17.188.141.156")}, 16) = 0 [pid 27958] 19:53:56 getsockname(12, {sa_family=AF_INET, sin_port=htons(54942), sin_addr=inet_addr("46.101.111.122")}, [16]) = 0 [pid 27958] 19:53:56 connect(12, {sa_family=AF_UNSPEC, sa_data="\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}, 16) = 0 [pid 27958] 19:53:56 connect(12, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("17.188.135.26")}, 16) = 0 [pid 27958] 19:53:56 getsockname(12, {sa_family=AF_INET, sin_port=htons(37714), sin_addr=inet_addr("46.101.111.122")}, [16]) = 0 [pid 27958] 19:53:56 connect(12, {sa_family=AF_UNSPEC, sa_data="\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}, 16) = 0 [pid 27958] 19:53:56 connect(12, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("17.188.130.157")}, 16) = 0 [pid 27958] 19:53:56 getsockname(12, {sa_family=AF_INET, sin_port=htons(43001), sin_addr=inet_addr("46.101.111.122")}, [16]) = 0 [pid 27958] 19:53:56 close(12) = 0 [pid 27958] 19:53:56 socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 12 [pid 27958] 19:53:56 fcntl(12, F_GETFL) = 0x2 (flags O_RDWR) [pid 27958] 19:53:56 fcntl(12, F_SETFL, O_RDWR|O_NONBLOCK) = 0 [pid 27958] 19:53:56 connect(12, {sa_family=AF_INET, sin_port=htons(2195), sin_addr=inet_addr("17.188.135.152")}, 16) = -1 EINPROGRESS (Operation now in progress)

This EINPROGRESS (Operation now in progress) lasts couple of minutes depend on how big is the memory limit and results in:
Symfony\Component\Debug\Exception\FatalErrorException: Allowed memory size of 536870912 bytes exhausted (tried to allocate 20480 bytes) in /default/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:59 Stack trace: #0 {main}

from pushnotification.

danielz0 avatar danielz0 commented on August 14, 2024

Hi @Edujugon
I think I found the problem which might be here reactphp/stream#64
Let me know your thoughts.

Best,
Daniel

from pushnotification.

Edujugon avatar Edujugon commented on August 14, 2024

Hi @danielz0 ,
Thank you for your support, I really appreciate it :)

Have you tested it in PHP 7.1.4 or 7.0.18 ? Does that work for you?

It seems to have a work-around for PHP < 7.1.4 (and PHP < 7.0.18) but since it has a performance penalty it may be the reason of that issue.

I have to test it in different PHP versions with a big data/payload to send.

from pushnotification.

Edujugon avatar Edujugon commented on August 14, 2024

The new releases (3.x & 2.2.x) prevent of this error.
I'm closing this issue. feel free to open it again if the error persists.

from pushnotification.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.