Django OSError:无法写入数据 [英] Django OSError: failed to write data

查看:36
本文介绍了Django OSError:无法写入数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此错误发生在logrotate开始营业的同一时间(可能logrotate删除了旧文件,但尚未创建新文件),有什么办法可以解决此问题?

This error happens exactly the same time when logrotate starts it's business (probably logrotate deleted the old file but not created the new one yet), is there any way to fix this?

[Tue Sep 09 19:40:02 2014] [error] [client 127.0.0.1] mod_wsgi (pid=11228): Exception occurred processing WSGI script '/var/www/example.com/project/wsgi.py'.
[Tue Sep 09 19:40:02 2014] [error] [client 127.0.0.1] OSError: failed to write data
[Tue Sep 09 19:40:02 2014] [error] Exception ignored in: <module 'threading' from '/opt/python3/lib/python3.4/threading.py'>
[Tue Sep 09 19:40:02 2014] [error] Traceback (most recent call last):
[Tue Sep 09 19:40:02 2014] [error]   File "/opt/python3/lib/python3.4/threading.py", line 1289, in _shutdown
[Tue Sep 09 19:40:02 2014] [error] Exception ignored in: <module 'threading' from '/opt/python3/lib/python3.4/threading.py'>
[Tue Sep 09 19:40:02 2014] [error] Traceback (most recent call last):
[Tue Sep 09 19:40:02 2014] [error]   File "/opt/python3/lib/python3.4/threading.py", line 1289, in _shutdown
[Tue Sep 09 19:40:02 2014] [error]     assert tlock is not None
[Tue Sep 09 19:40:02 2014] [error] AssertionError: 
[Tue Sep 09 19:40:02 2014] [error]     assert tlock is not None
[Tue Sep 09 19:40:02 2014] [error] AssertionError: 
Exception ignored in: <bound method Signal._remove_receiver of <django.dispatch.dispatcher.Signal object at 0x7fd6201f86a0>>
Traceback (most recent call last):
  File "/opt/python3/lib/python3.4/site-packages/django/dispatch/dispatcher.py", line 276, in _remove_receiver
NameError: name 'len' is not defined
Exception ignored in: <bound method Signal._remove_receiver of <django.dispatch.dispatcher.Signal object at 0x7fd6204be550>>
Traceback (most recent call last):
  File "/opt/python3/lib/python3.4/site-packages/django/dispatch/dispatcher.py", line 276, in _remove_receiver
NameError: name 'len' is not defined
...

推荐答案

错误表明您可能正在使用mod_wsgi守护程序模式.

The errors indicate you are likely using mod_wsgi daemon mode.

错误:

OSError: failed to write data

可能是因为代理mod_wsgi守护进程的Apache子工作进程已被杀死,同时仍通过代理进程从mod_wsgi守护进程回写了响应.触发logrotate确实可以触发该操作,因为它将导致进程被杀死.

is likely because the Apache child worker process which was proxying to the mod_wsgi daemon process was killed while a response was still being written back from the mod_wsgi daemon process via the proxying process. Triggering logrotate could indeed trigger that as it will cause processes to be killed off.

错误:

AssertionError: assert tlock is not None

是因为您使用的是旧的mod_wsgi版本,其中未进行任何更改以适应与解释程序破坏相关的Python 3.4更改内部.您需要升级mod_wsgi才能摆脱它.就其本身而言,无论如何该进程都不会退出,这不会造成问题,但是每次重新启动或关闭时,都会在日志文件中引起噪音.

is because you are using an old mod_wsgi version that doesn't have some changes in it to accommodate that Python 3.4 change internals related to interpreter destruction. You need to upgrade mod_wsgi to get rid of it. In itself it doesn't cause an issue as the process is exiting anyway, but will cause noise in the log files on every restart or shutdown.

这篇关于Django OSError:无法写入数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆