Skip to content

Process\Pool 必须设置onWorkerStart 否则无法getProcess() #2890

@HBSpy

Description

@HBSpy

Please answer these questions before submitting your issue. Thanks!

  1. What did you do? If possible, provide a simple script for reproducing the error.
 $pool = new Swoole\Process\Pool(2, SWOOLE_IPC_SOCKET);                                                                                                 
                                                                                                                                                        
 $pool->on('message', function($pool, $data){                                                                                                           
    var_dump($pool->getProcess());                                                                                                                     
 });                                                                                                                                                    
                                                                                                                                                        
 /* $pool->on('workerStart', function($pool, $id){ */                                                                                                   
 /* }); */                                                                                                                                              
                                                                                                                                                       
 $pool->listen('unix:/tmp/fuck.sock');                                                                                                                  
$pool->start();
  1. What did you expect to see?
    object(Swoole\Process)SW_BUFFER_SIZE=8192 #4 (6) {
    ["pipe"]=>
    NULL
    ["callback"]=>
    NULL
    ["msgQueueId"]=>
    NULL
    ["msgQueueKey"]=>
    NULL
    ["pid"]=>
    int(4172)
    ["id"]=>
    int(1)
    }

  2. What did you see instead?

bool(false)

  1. What version of Swoole are you using (show your php --ri swoole)?

Swoole => enabled
Author => Swoole Team team@swoole.com
Version => 4.4.7
Built => Oct 15 2019 16:50:59
coroutine => enabled
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
sockets => enabled
openssl => OpenSSL 1.0.2k-fips 26 Jan 2017
http2 => enabled
pcre => enabled
zlib => enabled
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
mysqlnd => enabled
async_redis => enabled

Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 8388608 => 8388608

  1. What is your machine environment used (including version of kernel & php & gcc) ?

PHP 7.3.7 (cli) (built: Jul 31 2019 11:40:53) ( NTS )
gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions