Skip to content

Cygwin下编译安装swoole-4.4.7的问题 #2868

@pechn

Description

@pechn
  • 编译swoole-4.4.7后可以正常安装和启动swoole_server,但无法接受client的连接
  • 在相同的cygwin环境下安装PHP-7.1.6和swoole-2.2.0,运行swoole_server一切正常,客户端和服务端收发信息都正常

以下是swoole_server的基本设置:

$this->serv = new swoole_server('0.0.0.0', 9501);
$this->serv->set(array(
            'worker_num'               => 4, // 开启的进程数量
            'max_request'              => 0, // TCP/UDP最大链接请求数
            'task_worker_num'          => 64, // 任务处理最大进程请求数
            'task_max_request'         => 0, // 设置task进程的最大任务数。一个task进程在处理完超过此数值的任务后将自动退出。这个参数是为了防止PHP进程内存溢出。如果不希望进程自动退出可以设置为0。
            'daemonize'                => 1, // 是否作为守护进程,此配置一般配合log_file使用
            'log_file'                 => $path, // 作为守护进程的日志
            'backlog'                  => 1024,
            'open_eof_split'           => true,
            'open_eof_check'           => true, // 开启分包校验,8个#号表示一次网络通信结束
            'package_eof'              => "########",
            'heartbeat_check_interval' => 60, // 表示每60秒,遍历所有连接
            'heartbeat_idle_time'      => 300, // 一个连接如果300秒内未向服务器发送任何数据,此连接将被强制关闭
            'package_max_length'       => 1024 * 1024 * 2, // 发送及接收缓冲区最大为2M
        ));

是否需要针对swoole 4.x和swoole 2.x进行代码调整?或者编译参数和选项有哪些需要调整的地方?

Please answer these questions before submitting your issue. Thanks!

  1. What did you do? If possible, provide a simple script for reproducing the error.
    Windows 10 1903 + Cygwin-3.0.7下通过源码编译安装Swoole-4.4.7
    PHP-7.3.7

  2. What did you expect to see?
    a) 编译成功
    b) make install成功装swoole.dll
    c) 正常启动swoole_server
    d) 客户端、服务端发送和接收正常

  3. What did you see instead?
    a) 编译成功
    b) make install成功装swoole.dll
    c) 正常启动swoole_server
    d) 客户端、服务端发送和接收异常

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

swoole

Swoole => enabled
Author => Swoole Team team@swoole.com
Version => 4.4.7
Built => Oct 7 2019 16:17:23
coroutine => enabled
signalfd => enabled
spinlock => enabled
rwlock => enabled
openssl => OpenSSL 1.1.1d 10 Sep 2019
http2 => enabled
pcre => enabled
zlib => enabled
mutex_timedlock => enabled
pthread_barrier => 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) ?
    Windows 10 1903
    Cygwin 3.0.7
    PHP 7.3.7
    gcc 7.4.0
    Make 4.2.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions