与维基百科相比,文件描述符的简化描述是什么?他们为什么需要?比如说,以shell进程为例,它是如何应用的?
进程表是否包含多个文件描述符.如果是,为什么?
我在谷歌计算上运行了一个 nginx-gunicorn-flask 设置,我不断从 gunicorn 获得以下信息:
[2019-04-19 20:50:49 +0000] [3345] [DEBUG] POST /
[2019-04-19 20:50:49 +0000] [3345] [DEBUG] Ignoring EPIPE
Run Code Online (Sandbox Code Playgroud)
在 100 个请求中,大约有 23 个是这样出现的。在访问日志中只显示了 23 个请求,它们都是 200 个。
从 nginx 访问日志显示 504,在错误日志中我看到:
2019/04/19 20:50:49 [error] 3097#3097: *295 upstream timed out (110: Connection timed out) while sending request to upstream, client: ip, server: , request: "POST / HTTP/1.1", upstream: "http://unix:/home/user/Server/server.sock/", host: "ip"
Run Code Online (Sandbox Code Playgroud)
我试过设置
proxy_connect_timeout 75s;
proxy_read_timeout 300s;
Run Code Online (Sandbox Code Playgroud)
--timeout 300根据其他问题在 nginx 和gunicorn上的位置,但没有帮助。
来自 gunicorn 的消息并没有真正帮助确定原因,我没有找到任何相关信息
一直试图解决这个问题,我很感激任何想法。此外,这些请求中的每一个都需要大约 1-2 秒,并且 jmeter …
我使用以下函数在Python中运行命令:
def run_proc(cmd):
child = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = child.communicate()
returncode = child.returncode
return stdout, stderr, returncode
Run Code Online (Sandbox Code Playgroud)
它一直工作正常,但现在我正在尝试使用该yes程序将输出管道输出到stdin.我正在尝试运行的命令如下:
yes '' | apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade
Run Code Online (Sandbox Code Playgroud)
但我相信它可以用一般的例子代替,例如:
yes | head -3 | cat
Run Code Online (Sandbox Code Playgroud)
我的问题是,如果我尝试运行其中的任何命令yes |,上面的subprocess.Popen将包含错误消息:
yes: standard output: Broken pipe
yes: write error
Run Code Online (Sandbox Code Playgroud)
对我来说,似乎管道仍然可以工作,从yes | head -3 | cat答案中可以看出:y y y.
我有以下问题:
python ×2
command-line ×1
gunicorn ×1
linux ×1
nginx ×1
server ×1
shell ×1
subprocess ×1
ubuntu-18.04 ×1
unix ×1