Hello!
2013/3/13 wgm.china:
> 大家好!
> 我在用openresty通过io.popen调用linux命令,在功能测试的时候没有问题,在开始用压力测试loadrunner压30个并发的时候,就开始在nginx
> errlog中看到报错了。
> 具体的报错信息:
> [error] 1802#0: *46160 lua entry thread aborted: runtime error:
> /usr/local/lua/hbds_upload.lua:0: Interrupted system call
>
> 具体的调用代码:local popen =io.popen(gcs_upload_command)
>
这个问题先前在 openresty 邮件列表中有过专门的讨论,你可以参考一下:
https://groups.google.com/group/openresty/browse_thread/thread/abd0fbfa087bea75/e89acf6eeee3eec4
引用一下那里的原文:“io.popen 确实创建了新的 sh 子进程,而当 sh
子进程退出时,便会自动向它的父进程,也就是调用 io.popen 的 nginx worker 进程发送 SIGCHLD 信号。而如果此时
nginx 正阻塞在 io.read() 发起的 read 系统调用上时,则该系统调用就会被中断,并返回错误“Interrupted
system call”. 一个直接的解决办法是,总是显式地调用 io.close() 方法关闭当前的 pipe 文件句柄”
特别地,io.popen 这样的调用总是阻塞的,这意味着在你的 shell 命令执行时,你当前的 nginx worker 进程只能处理 1
个并发。所以要慎用。
Best regards,
-agentzh
--
--
邮件自: 列表“openresty”,专用于技术讨论!
发言: 请发邮件到 openresty@googlegroups.com
退订: 请发邮件至 openresty+unsubscribe@googlegroups.com
详情: http://groups.google.com/group/openresty
官网: http://openresty.org/
仓库: https://github.com/agentzh/ngx_openresty
建议: 提问的智慧 http://wiki.woodpecker.org.cn/moin/AskForHelp
教程: http://agentzh.org/misc/nginx/agentzh-nginx-tutorials-zhcn.html
---
您收到此邮件是因为您订阅了 Google 网上论坛的“openresty”论坛。
要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到 openresty+unsubscribe@googlegroups.com。
要查看更多选项,请访问 https://groups.google.com/groups/opt_out。