带有 --master 的 uWSGI 导致 Illegal Seek 错误
uWSGI with --master causing Illegal Seek errors
最终将范围缩小到 --master 标志。如果我启用了主进程,那么在启动 uwsgi 之后我会得到大量这样的东西,大约每秒 1 个:
uwsgi_check_logrotate()/lseek():非法查找 [core/logging.c 第 497 行]
我一直在研究 uwsgi 文档,但找不到任何关于如何正确设置主机或它需要什么才能正常运行的信息。
任何帮助将不胜感激,因为我读过主流程对于生产环境非常重要。
编辑
我不确定为什么打开 --master 进程会导致这种情况发生,但我最终偶然发现了一个可能的原因:
The most basic form of logging in uWSGI is writing requests, errors, and >informational messages to stdout/stderr. This happens in the default >configuration. The most basic form of log redirection is the --logto / --logto2 / >--daemonize options which allow you to redirect logs to files.
我已经声明了 logto = path/to/logfile,但没有意识到默认行为是将日志发送到标准输出。所以我创建了一个系统 link 以从我的日志文件中输出。
然而,当 --master 进程未打开时,这似乎不是问题。
未能真正解决它,所以我的解决方案是简单地删除系统 link 我的 uwsgi.ini 以及我的 uwsgi.ini 中的 logto 命令,因为默认行为是将日志发送到 stdout 和 stderr。如果能够将日志发送到 stdout/stderr 以及文件,那就太好了,但现在就可以了。
我通过使用标志将日志记录委托给主进程解决了这个问题:
--log-master
来自 https://github.com/unbit/uwsgi/blob/d960f8fdc36b33c60b7291ca8e32dbb5df22cf15/core/uwsgi.c#L794
{"log-master", no_argument, 0, "delegate logging to master process",
uwsgi_opt_true, &uwsgi.log_master,
UWSGI_OPT_MASTER|UWSGI_OPT_LOG_MASTER},
最终将范围缩小到 --master 标志。如果我启用了主进程,那么在启动 uwsgi 之后我会得到大量这样的东西,大约每秒 1 个:
uwsgi_check_logrotate()/lseek():非法查找 [core/logging.c 第 497 行]
我一直在研究 uwsgi 文档,但找不到任何关于如何正确设置主机或它需要什么才能正常运行的信息。
任何帮助将不胜感激,因为我读过主流程对于生产环境非常重要。
编辑
我不确定为什么打开 --master 进程会导致这种情况发生,但我最终偶然发现了一个可能的原因:
The most basic form of logging in uWSGI is writing requests, errors, and >informational messages to stdout/stderr. This happens in the default >configuration. The most basic form of log redirection is the --logto / --logto2 / >--daemonize options which allow you to redirect logs to files.
我已经声明了 logto = path/to/logfile,但没有意识到默认行为是将日志发送到标准输出。所以我创建了一个系统 link 以从我的日志文件中输出。
然而,当 --master 进程未打开时,这似乎不是问题。
未能真正解决它,所以我的解决方案是简单地删除系统 link 我的 uwsgi.ini 以及我的 uwsgi.ini 中的 logto 命令,因为默认行为是将日志发送到 stdout 和 stderr。如果能够将日志发送到 stdout/stderr 以及文件,那就太好了,但现在就可以了。
我通过使用标志将日志记录委托给主进程解决了这个问题:
--log-master
来自 https://github.com/unbit/uwsgi/blob/d960f8fdc36b33c60b7291ca8e32dbb5df22cf15/core/uwsgi.c#L794
{"log-master", no_argument, 0, "delegate logging to master process", uwsgi_opt_true, &uwsgi.log_master, UWSGI_OPT_MASTER|UWSGI_OPT_LOG_MASTER},