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

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

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

Comments

Projects
None yet
5 participants
@german-chosen
Copy link

german-chosen commented Dec 18, 2014

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

This comment has been minimized.

Copy link

cvuorinen commented Mar 30, 2015

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

This comment has been minimized.

Copy link

cvuorinen commented Mar 31, 2015

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

This comment has been minimized.

Copy link
Contributor

mwillbanks commented Apr 6, 2015

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

@cvuorinen

This comment has been minimized.

Copy link

cvuorinen commented Apr 8, 2015

@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

This comment has been minimized.

Copy link

ghost commented Apr 8, 2015

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

@cvuorinen

This comment has been minimized.

Copy link

cvuorinen commented Apr 9, 2015

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

@ghost

This comment has been minimized.

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

This comment has been minimized.

Copy link

cvuorinen commented Apr 11, 2015

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

@cvuorinen

This comment has been minimized.

Copy link

cvuorinen commented Apr 15, 2015

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

This comment has been minimized.

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

This comment has been minimized.

Copy link

RileyMills commented Jun 5, 2015

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.

@mwillbanks mwillbanks closed this Jun 8, 2015

@potsky

This comment has been minimized.

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 join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.