Skip to content

Latest commit

 

History

History
37 lines (23 loc) · 1.64 KB

File metadata and controls

37 lines (23 loc) · 1.64 KB

已知的兼容性问题

监听系统事件

// 重置Agent
\Event::listen('laravels.received_request', function (\Illuminate\Http\Request $req, $app) {
    $app->agent->setHttpHeaders($req->server->all());
    $app->agent->setUserAgent();
});

不能使用这些函数

  • flush/ob_flush/ob_end_flush/ob_implicit_flushswoole_http_response不支持flush

  • dd()/exit()/die(): 将导致Worker/Task/Process进程立即退出,建议通过抛异常跳出函数调用栈,Swoole文档

  • header()/setcookie()/http_response_code():HTTP响应只能通过Laravel/Lumen的Response对象。

不能使用的全局变量

  • $_SESSION

大小限制

  • Swoole限制了GET请求头的最大尺寸为8KB,建议Cookie的不要太大,不然$_COOKIE可能解析失败。

  • POST数据或文件上传的最大尺寸受Swoole配置package_max_length影响,默认上限2M

Inotify监听文件数达到上限

Warning: inotify_add_watch(): The user limit on the total number of inotify watches was reached

  • LinuxInotify监听文件数默认上限一般是8192,实际项目的文件数+目录树很可能超过此上限,进而导致后续的监听失败。

  • 增加此上限到524288echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p,注意Docker时需设置启用privileged