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

stream_select(): You MUST recompile PHP with a larger value of FD_SETSIZE #693

Closed
monsieurchico opened this issue May 22, 2019 · 12 comments
Closed

Comments

@monsieurchico
Copy link

Hello,

I known there already are closed issues on the subject but I encounter this error on one of my project. I tried to downgrade the version to 2.7.0 and it worked.

But it's not really a reliable solution....

May be a retry system could be implemented ?

My stack :

  • php 7.1.28 (docker alpine version)
  • symfony 4.2
  • swarrot bundle

The full error :

[2019-05-22 11:23:38] app.ERROR: Uncaught exception of type PhpAmqpLib\Exception\AMQPIOWaitException {"exception_message":"stream_select(): You MUST recompile PHP with a larger value of FD_SETSIZE.\nIt is set to 1024, but you have descriptors numbered at least as high as 1610.\n --enable-fd-setsize=2048 is recommended, but you may want to set it\nto equal the maximum number of open files supported by your system,\nin order to avoid seeing this error again at a later date.","class":"PhpAmqpLib\Exception\AMQPIOWaitException","code":0,"file":"/app/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Wire/IO/AbstractIO.php:89","app_code":"INTERNAL_SERVER_ERROR"} []

@ramunasd
Copy link
Member

Hi @monsieurchico , can You try latest version with disabled tcp_nodelay ? I think #517 is the only one change which can cause this type of error.

@monsieurchico
Copy link
Author

How can I disable tcp_nodelay ?

@ramunasd
Copy link
Member

$context = stream_context_create();
$connection = new AMQPStreamConnection($host, $port, $user, $password, $vhost, false, 'AMQPLAIN', null, 'en_US', 3, 130, $context);

@monsieurchico
Copy link
Author

Is there a way to do it in swarrot ?

@ramunasd
Copy link
Member

@monsieurchico please ask there :)

@lukebakken
Copy link
Collaborator

Assuming addressed by @ramunasd 's comment here.

@ym2048
Copy link

ym2048 commented Jan 10, 2020

@lukebakken I also meet the problem。Our enviroment is as follow:
php: 7.1.2
php-amqplib:2.11.0

I tried your suggestion,
$context = stream_context_create();
$connection = new AMQPStreamConnection($host, $port, $user, $password, $vhost, false, 'AMQPLAIN', null, 'en_US', 3, 130, $context);

create a stream_context object and pass into AMQPStreamConnection construction method,
but it doesn't solve the probleam.

Can you give me more suggestion, thank you very mush!

@ym2048
Copy link

ym2048 commented Jan 10, 2020

@monsieurchico
we also downgrade the version to 2.7.0, is that you final solution?

@ramunasd
Copy link
Member

@ym2048 can You prepare example on how to reproduce this issue?

@ym2048
Copy link

ym2048 commented Jan 23, 2020

@ramunasd we tried millions times using apache ab tool in development environment, but we did not reproduce the problem. in product environment, it occurs frequently

@ramunasd
Copy link
Member

@ym2048 So in which sapi you get this error? CLI or CGI?
I guess there is something wrong in Your client code. You either spinning up too much processes or each process opens too much connections. Single process single connection consumes only one file descriptor.

More context:
https://bugs.php.net/bug.php?id=69637
https://bugs.php.net/bug.php?id=37025

@gitsrc
Copy link

gitsrc commented Feb 20, 2020

Centos operating system can try to adjust the LimitNPROC parameter of systemd or kernel。

# Specifies the maximum number of processes
LimitNPROC=4096

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

5 participants