Skip to content
This repository has been archived by the owner on Dec 7, 2019. It is now read-only.

It sends the APN but hangs until execution time is expired #19

Closed
german-chosen opened this issue Dec 18, 2014 · 12 comments
Closed

It sends the APN but hangs until execution time is expired #19

german-chosen opened this issue Dec 18, 2014 · 12 comments

Comments

@german-chosen
Copy link

The thing is that I receive the notification, but the script just continue running.

This is what I got when using ZF2 (it doesn't happen all the time, I can say):

PHP Warning: fread(): SSL: Invalid argument in .../ZendService/Apple/Apns/Client/AbstractClient.php on line 156
PHP Fatal error: The request was aborted because it exceeded the maximum execution time. in .../ZendService/Apple/Apns/Client/AbstractClient.php on line 156

@cvuorinen
Copy link

I have the same problem. Just hangs there with 100% CPU while trying to read the socket stream with fread.
This happens when using a valid token and the actual push notification is delivered to my device.
When using fake token the code works and immediately returns status code 8 (invalid token).

At first I thought it was the same issue as here: http://stackoverflow.com/questions/7501289/php-fread-hangs-when-using-ssl
But socket_get_status says there are 0 unread bytes, even with the invalid token when there actually is stuff to read and the fread works.

Anybody have any idea what might be causing this? Is this a bug in PHP or something? I'm on a Ubuntu machine with PHP v5.6.7.

@cvuorinen
Copy link

On a CentOS server with PHP v5.4.16 the same code executes nicely without any delay, so it looks like the issue is with Ubuntu or the newer PHP version. I think I'll file a bug report for PHP, just need to figure out some minimal code example to reproduce it.

@mwillbanks
Copy link
Contributor

@cvuorinen is the debian / ubuntu server running suhosin or something random like that?

@cvuorinen
Copy link

@mwillbanks no, nothing special like that.

I have tested this on a few different CentOS servers, running PHP 5.4, 5.5 and 5.6 and all work correctly. And on a Debian server running PHP 5.4 which also works. So it definitely seems to be something environment specific. The Ubuntu machine where it doesn't work is my development machine so it's not a really big issue for me right now, but I'll see if I can find any other machine where the issue can be reproduced and then maybe get a better idea what's causing it.

@ghost
Copy link

ghost commented Apr 8, 2015

Also started seeing this on a new server. Ubuntu 14.04.2, PHP 5.6.7

@cvuorinen
Copy link

@danielstqry OK, seems to be something about that environment then, I also have Ubuntu 14.04 and PHP 5.6.7.

@ghost
Copy link

ghost commented Apr 9, 2015

Compiled PHP 5.6.6 and 5.6.7 for comparison. Works fine on 5.6.6 but not 5.6.7

5.6.6: 0.13 seconds
5.6.7 60.13 seconds

5.6.7 with a timeout:

ini_set('default_socket_timeout', 10);

10.22 seconds.

@cvuorinen
Copy link

Thanks for the info. I have filed a bug about this: https://bugs.php.net/bug.php?id=69402

@cvuorinen
Copy link

FYI, this should be fixed in upcoming PHP versions (5.5.25 and 5.6.9).
You can check the comments in the bug report for more details if interested.

@ghost
Copy link

ghost commented Apr 15, 2015

What a pain that a fix won't make it into 5.6.8. I wonder if you had any ideas about rolling back to 5.6.6 with apt-get on Ubuntu? I'm using PPA ondrej/php5-5.6 and it doesn't seem possible.

@RileyMills
Copy link

For what it's worth I just ran into this issue in a Laravel Homestead VM on 5.6.7 and upgrading PHP to 5.6.9 resolved the issue. This one was an interesting one to track down, so thanks for finally pointing me in the right direction guys.

@potsky
Copy link

potsky commented Jul 1, 2015

Same problem on Centos 6.6 with PHP 5.5.24. No more problem on 5.5.26 :-)

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

No branches or pull requests

5 participants