Django配置uwsgi时log文件报错thunder lock: disabled (you can enable it with --thunder-lock)

一、问题来源

    使用uwsgi --ini mysite.ini命令启动后使用ps -aux | grep uwsgi命令查询uwsgi的相关进程,但是查询不到,发现只有下面一个进程,说明uwsgi启动ini文件失败。

root      201642  0.0  0.0   9032   728 pts/0    S+   12:16   0:00 grep --color=auto uwsgi

    后面,通过vim打开log文件查询是否有报错,发现下面这种错误,报错信息是thunder lock: disabled (you can enable it with --thunder-lock)
bind(): Permission denied [core/socket.c line 769]。

our processes number limit is 31045
your memory page size is 4096 bytes
 *** WARNING: you have enabled harakiri without post buffering. Slow upload could be rejected on post-unbuffered webservers ***
detected max file descriptor number: 65535
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
bind(): Permission denied [core/socket.c line 769]

二、解决方案

    通过查阅相关资料,我先尝试了下面两种方法。
    1. 使用root权限:即sudo uwsgi --ini mysite.ini
    2. 在mysite.ini文件中更改socket参数的目录为tmp,即socket = /tmp/mysite.sock
    第二种方法可以解决我的问题,但是后面发现这不是真正的原因。
    实际上,我发现我的报错是由于mysite.ini中配置的socket与nginx中mysite.conf文件uwsgi_pass配置的IP地址与端口不一样造成的,将mysite.ini中的socket与/etc/nginx中mysite.conf文件的uwsgi_pass设置为相同的IP地址和端口后就解决了这一问题。

*** Starting uWSGI 2.0.17.1 (64bit) on [Thu May 25 21:02:53 2023] *** compiled with version: 4.8.2 20140120 (Red Hat 4.8.2-16) on 25 May 2023 09:54:48 os: Linux-3.10.0-862.3.2.el7.x86_64 #1 SMP Mon May 21 23:36:36 UTC 2018 nodename: vga-fmea-pbd machine: x86_64 clock source: unix pcre jit disabled detected number of CPU cores: 32 current working directory: /web/www/teamvision/uwsgi-2.0.17.1 detected binary path: /web/www/teamvision/uwsgi-2.0.17.1/uwsgi chdir() to /web/www/teamvision your processes number limit is 4096 your memory page size is 4096 bytes *** WARNING: you have enabled harakiri without post buffering. Slow upload could be rejected on post-unbuffered webservers *** detected max file descriptor number: 1024 VirtualHosting mode enabled. lock engine: pthread robust mutexes thunder lock: disabled (you can enable it with --thunder-lock) uwsgi socket 0 bound to TCP address 0.0.0.0:8033 fd 6 Python version: 3.5.4 (default, May 25 2023, 15:10:10) [GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] Python main interpreter initialized at 0x16ca940 python threads support enabled your server socket listen backlog is limited to 100 connections your mercy for graceful operations on workers is 10 seconds mapped 2539800 bytes (2480 KB) for 24 cores *** Operational MODE: preforking *** added /usr/local/python3.5b/python3.5/site-packages to pythonpath. Traceback (most recent call last): File "./teamvision/web_wsgi.py", line 7, in <module> from django.core.wsgi import get_wsgi_application ImportError: No module named 'django' unable to load app 0 (mountpoint='') (callable not found or import error) *** no app loaded. going in full dynamic mode *** *** uWSGI is running in multiple interpreter mode *** spawned uWSGI master process (pid: 376163) spawned uWSGI worker 1 (pid: 376164, cores: 1) spawned uWSGI worker 2 (pid: 376165, cores: 1)
05-30
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值