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

http sever在达到max_request时请求会出错 #2555

Closed
kant712 opened this issue May 6, 2019 · 2 comments
Closed

http sever在达到max_request时请求会出错 #2555

kant712 opened this issue May 6, 2019 · 2 comments

Comments

@kant712
Copy link

kant712 commented May 6, 2019

如下列代码所示,我起了一个http server,在onRequest事件中,去发一个http请求。
设置worker_num为1,max_request为5。现象是当我第5次调用时,请求就一直挂在那,没有任何应答,同时http server也没有任何报错。
然而,如果在onRequest事件中的处理逻辑中不发http请求,则一起正常。

<?php
$http = new Swoole\Http\Server( "168.63.129.93" , 9501 );
$http->set( [
    'worker_num' => 1 ,
    'max_request' => 5 ,
] );
$http->on( "request" , function( $request , $response )
{
    $swooleClient = new \Co\Http\Client( '168.63.129.51' , 8081 );
    $swooleClient->set( [
        'timeout' => 1 ,
        'keep_alive' => false ,
    ] );
    $swooleClient->post( '/sleep' , [ 'time' => '50' ] );
    $response->write( $swooleClient->body );
    return;
} );
$http->start();
Swoole => enabled
Author => Swoole Team <team@swoole.com>
Version => 4.3.2
Built => Apr 17 2019 16:32:48
coroutine => enabled
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
http2 => enabled
pcre => enabled
zlib => enabled
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
async_redis => enabled
Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 8388608 => 8388608
@matyhtf
Copy link
Member

matyhtf commented May 6, 2019

请启用 reload_async 选项

@kant712
Copy link
Author

kant712 commented May 6, 2019

请启用 reload_async 选项

已解决,谢谢!

@kant712 kant712 closed this as completed May 6, 2019
matyhtf added a commit that referenced this issue May 6, 2019
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

2 participants