unbit / uwsgi

uWSGI application server container
http://projects.unbit.it/uwsgi
Other
3.46k stars 691 forks source link

No warning / error on chdir failure #1094

Open KES777 opened 9 years ago

KES777 commented 9 years ago

When chdir to not existent dir I get wrong error message in log file:

chdir      = /home/kes/work/www/mojo/test/myapp

[uWSGI] getting INI configuration from /usr/share/uwsgi/conf/default.ini
[uWSGI] getting INI configuration from /etc/uwsgi/apps-enabled/geekbrains.ini
open("./logfile_plugin.so"): No such file or directory [core/utils.c line 3696]
!!! UNABLE to load uWSGI plugin: ./logfile_plugin.so: cannot open shared object
file: No such file or directory !!!

If I correct to chdir = /home/kes/work/www/mojo/test/my_app uwsgi starts up OK.

full config:

[uwsgi]
# vassal_name = %n
# In the vassal-defaults.ini, you write:
# socket = /tmp/sockets/%(vassal_name).sock

uid = kes
gid = www-data

memory-report      = true
single-interpreter = true
stats              = /tmp/uwsgitop.%n.socket
master             = true
workers            = 1

# This is buffer for cookie. It's 4K by specification.
# buffer-size = 4096

plugins=logfile

# chdir      = /home/kes/work/www/%n
chdir      = /home/kes/work/www/mojo/test/myapp
logger     = file:logs/uwsgi_error.log
req-logger = file:logs/uwsgi_access.log

manage-script-name = true
# These are same, but second allow to mount more apps in different mount points
# psgi     = bin/MasonHandler.psgi
# myapp      = bin/MasonHandler.psgi
myapp      = t.pl
mount      = /=%(myapp)

perl-auto-reload = 2
touch-reload     = %(myapp)
touch-reload     = %p
touch-reload     = conf/log4perl.conf
touch-reload     = conf/config.yaml

env = PERL5LIB=lib:/home/kes/perl5/lib/perl5
if-not-reload =
env = PATH=/home/kes/perl5/bin:$(PATH)
endif =
depaolim commented 9 years ago

@KES777 exact uwsgi build you are using?

for this test.ini

[uwsgi]
plugins             = logfile
chdir               = /nonexistent

on uWSGI 2.1-dev-717bf5a I get:

chdir() to /nonexistent
chdir(): No such file or directory [core/uwsgi.c line 2682]
KES777 commented 9 years ago

uwsgi --version 2.1-dev-095c750

xrmx commented 9 years ago

@KES777 are you sure you don't have the error on the very next line of what you pasted?

KES777 commented 9 years ago

Yes. I am sure.

Difference between cofigurations:

kes@keswork /etc/uwsgi/apps-available $ git diff geekbrains geekbrains.fail
diff --git a/geekbrains b/geekbrains.fail
index 59e7306..311f90b 100644
--- a/geekbrains
+++ b/geekbrains.fail
@@ -19,7 +19,7 @@ workers            = 1

 plugins=logfile

-chdir      = /home/kes/work/www/mojo/test/my_app
+chdir      = /home/kes/work/www/mojo/test/myapp
 logger     = file:logs/uwsgi_error.log
 req-logger = file:logs/uwsgi_access.log

Logs before expirements

kes@keswork /etc/uwsgi/apps-available $ cat /var/log/uwsgi/app/geekbrains.log
kes@keswork /etc/uwsgi/apps-available $ cat ~/work/www/mojo/test/my_app/logs/uwsgi_error.log

Start server with normal configuration

kes@keswork /etc/uwsgi/apps-available $ cat ~/u
#!/bin/sh

sudo /etc/init.d/uwsgi restart
kes@keswork /etc/uwsgi/apps-available $ ~/u
 * Restarting app server(s) uwsgi                                        [ OK ]
kes@keswork /etc/uwsgi/apps-available $ cat /var/log/uwsgi/app/geekbrains.logkes@keswork /etc/uwsgi/apps-available $ cat ~/work/www/mojo/test/my_app/logs/uwsgi_error.log
Wed Nov  4 11:22:34 2015 - *** Starting uWSGI 2.1-dev-095c750 (64bit) on [Wed Nov  4 11:22:34 2015] ***
Wed Nov  4 11:22:34 2015 - compiled with version: 4.8.4 on 30 August 2015 19:57:26
Wed Nov  4 11:22:34 2015 - os: Linux-3.13.0-37-generic #64-Ubuntu SMP Mon Sep 22 21:28:38 UTC 2014
Wed Nov  4 11:22:34 2015 - nodename: keswork
Wed Nov  4 11:22:34 2015 - machine: x86_64
Wed Nov  4 11:22:34 2015 - clock source: unix
Wed Nov  4 11:22:34 2015 - pcre jit disabled
Wed Nov  4 11:22:34 2015 - detected number of CPU cores: 4
Wed Nov  4 11:22:34 2015 - current working directory: /
Wed Nov  4 11:22:34 2015 - writing pidfile to /run/uwsgi/app/geekbrains/pid
Wed Nov  4 11:22:34 2015 - detected binary path: /usr/bin/uwsgi-core
Wed Nov  4 11:22:34 2015 - setgid() to 33
Wed Nov  4 11:22:34 2015 - set additional group 4 (adm)
Wed Nov  4 11:22:34 2015 - set additional group 6 (disk)
Wed Nov  4 11:22:34 2015 - set additional group 24 (cdrom)
Wed Nov  4 11:22:34 2015 - set additional group 27 (sudo)
Wed Nov  4 11:22:34 2015 - set additional group 30 (dip)
Wed Nov  4 11:22:34 2015 - set additional group 46 (plugdev)
Wed Nov  4 11:22:34 2015 - set additional group 108 (lpadmin)
Wed Nov  4 11:22:34 2015 - set additional group 110 (sambashare)
Wed Nov  4 11:22:34 2015 - set additional group 124 (vboxusers)
Wed Nov  4 11:22:34 2015 - setuid() to 1000
Wed Nov  4 11:22:34 2015 - chdir() to /home/kes/work/www/mojo/test/my_app
Wed Nov  4 11:22:34 2015 - your processes number limit is 30814
Wed Nov  4 11:22:34 2015 - your memory page size is 4096 bytes
Wed Nov  4 11:22:34 2015 - detected max file descriptor number: 1024
Wed Nov  4 11:22:34 2015 - lock engine: pthread robust mutexes
Wed Nov  4 11:22:34 2015 - thunder lock: disabled (you can enable it with --thunder-lock)
Wed Nov  4 11:22:34 2015 - uwsgi socket 0 bound to UNIX address /run/uwsgi/app/geekbrains/socket fd 9
Wed Nov  4 11:22:34 2015 - Python version: 2.7.6 (default, Jun 22 2015, 18:01:27)  [GCC 4.8.2]
Wed Nov  4 11:22:34 2015 - *** Python threads support is disabled. You can enable it with --enable-threads ***
Wed Nov  4 11:22:34 2015 - Python main interpreter initialized at 0x1ce37f0
Wed Nov  4 11:22:34 2015 - initialized Perl 5.18.2 main interpreter at 0x1d4a620
Wed Nov  4 11:22:34 2015 - your server socket listen backlog is limited to 100 connections
Wed Nov  4 11:22:34 2015 - your mercy for graceful operations on workers is 60 seconds
Wed Nov  4 11:22:34 2015 - your request buffer size is 4096 bytes
Wed Nov  4 11:22:34 2015 - mapped 145584 bytes (142 KB) for 1 cores
Wed Nov  4 11:22:34 2015 - *** Operational MODE: single process ***
Wed Nov  4 11:22:34 2015 - mounting script/my_app on /
Wed Nov  4 11:22:34 2015 - mounting script/my_app on /
Wed Nov  4 11:22:34 2015 - *** no app loaded. going in full dynamic mode ***
Wed Nov  4 11:22:34 2015 - spawned uWSGI master process (pid: 10752)
Wed Nov  4 11:22:34 2015 - spawned uWSGI worker 1 (pid: 10761, cores: 1)
Wed Nov  4 11:22:34 2015 - *** Stats server enabled on /tmp/uwsgitop.geekbrains.socket fd: 15 ***
Wed Nov  4 11:22:34 2015 - unable to stat() conf/log4perl.conf, events will be triggered as soon as the file is created
Wed Nov  4 11:22:34 2015 - unable to stat() conf/config.yaml, events will be triggered as soon as the file is created

put wrong config file and run server

kes@keswork /etc/uwsgi/apps-available $ sudo cp geekbrains.fail geekbrains
kes@keswork /etc/uwsgi/apps-available $ ~/u
 * Restarting app server(s) uwsgi                                        [fail] 
kes@keswork /etc/uwsgi/apps-available $ cat /var/log/uwsgi/app/geekbrains.log
[uWSGI] getting INI configuration from /usr/share/uwsgi/conf/default.ini
[uWSGI] getting INI configuration from /etc/uwsgi/apps-enabled/geekbrains.ini
open("./logfile_plugin.so"): No such file or directory [core/utils.c line 3696]
!!! UNABLE to load uWSGI plugin: ./logfile_plugin.so: cannot open shared object file: No such file or directory !!!
kes@keswork /etc/uwsgi/apps-available $ cat ~/work/www/mojo/test/my_app/logs/uwsgi_error.log 
Wed Nov  4 11:22:34 2015 - *** Starting uWSGI 2.1-dev-095c750 (64bit) on [Wed Nov  4 11:22:34 2015] ***
Wed Nov  4 11:22:34 2015 - compiled with version: 4.8.4 on 30 August 2015 19:57:26
Wed Nov  4 11:22:34 2015 - os: Linux-3.13.0-37-generic #64-Ubuntu SMP Mon Sep 22 21:28:38 UTC 2014
Wed Nov  4 11:22:34 2015 - nodename: keswork
Wed Nov  4 11:22:34 2015 - machine: x86_64
Wed Nov  4 11:22:34 2015 - clock source: unix
Wed Nov  4 11:22:34 2015 - pcre jit disabled
Wed Nov  4 11:22:34 2015 - detected number of CPU cores: 4
Wed Nov  4 11:22:34 2015 - current working directory: /
Wed Nov  4 11:22:34 2015 - writing pidfile to /run/uwsgi/app/geekbrains/pid
Wed Nov  4 11:22:34 2015 - detected binary path: /usr/bin/uwsgi-core
Wed Nov  4 11:22:34 2015 - setgid() to 33
Wed Nov  4 11:22:34 2015 - set additional group 4 (adm)
Wed Nov  4 11:22:34 2015 - set additional group 6 (disk)
Wed Nov  4 11:22:34 2015 - set additional group 24 (cdrom)
Wed Nov  4 11:22:34 2015 - set additional group 27 (sudo)
Wed Nov  4 11:22:34 2015 - set additional group 30 (dip)
Wed Nov  4 11:22:34 2015 - set additional group 46 (plugdev)
Wed Nov  4 11:22:34 2015 - set additional group 108 (lpadmin)
Wed Nov  4 11:22:34 2015 - set additional group 110 (sambashare)
Wed Nov  4 11:22:34 2015 - set additional group 124 (vboxusers)
Wed Nov  4 11:22:34 2015 - setuid() to 1000
Wed Nov  4 11:22:34 2015 - chdir() to /home/kes/work/www/mojo/test/my_app
Wed Nov  4 11:22:34 2015 - your processes number limit is 30814
Wed Nov  4 11:22:34 2015 - your memory page size is 4096 bytes
Wed Nov  4 11:22:34 2015 - detected max file descriptor number: 1024
Wed Nov  4 11:22:34 2015 - lock engine: pthread robust mutexes
Wed Nov  4 11:22:34 2015 - thunder lock: disabled (you can enable it with --thunder-lock)
Wed Nov  4 11:22:34 2015 - uwsgi socket 0 bound to UNIX address /run/uwsgi/app/geekbrains/socket fd 9
Wed Nov  4 11:22:34 2015 - Python version: 2.7.6 (default, Jun 22 2015, 18:01:27)  [GCC 4.8.2]
Wed Nov  4 11:22:34 2015 - *** Python threads support is disabled. You can enable it with --enable-threads ***
Wed Nov  4 11:22:34 2015 - Python main interpreter initialized at 0x1ce37f0
Wed Nov  4 11:22:34 2015 - initialized Perl 5.18.2 main interpreter at 0x1d4a620
Wed Nov  4 11:22:34 2015 - your server socket listen backlog is limited to 100 connections
Wed Nov  4 11:22:34 2015 - your mercy for graceful operations on workers is 60 seconds
Wed Nov  4 11:22:34 2015 - your request buffer size is 4096 bytes
Wed Nov  4 11:22:34 2015 - mapped 145584 bytes (142 KB) for 1 cores
Wed Nov  4 11:22:34 2015 - *** Operational MODE: single process ***
Wed Nov  4 11:22:34 2015 - mounting script/my_app on /
Wed Nov  4 11:22:34 2015 - mounting script/my_app on /
Wed Nov  4 11:22:34 2015 - *** no app loaded. going in full dynamic mode ***
Wed Nov  4 11:22:34 2015 - spawned uWSGI master process (pid: 10752)
Wed Nov  4 11:22:34 2015 - spawned uWSGI worker 1 (pid: 10761, cores: 1)
Wed Nov  4 11:22:34 2015 - *** Stats server enabled on /tmp/uwsgitop.geekbrains.socket fd: 15 ***
Wed Nov  4 11:22:34 2015 - unable to stat() conf/log4perl.conf, events will be triggered as soon as the file is created
Wed Nov  4 11:22:34 2015 - unable to stat() conf/config.yaml, events will be triggered as soon as the file is created
Wed Nov  4 11:23:50 2015 - *** /etc/uwsgi/apps-enabled/geekbrains.ini has been touched... grace them all !!! ***
Wed Nov  4 11:23:50 2015 - ...gracefully killing workers...
Wed Nov  4 11:23:50 2015 - Gracefully killing worker 1 (pid: 10761)...
kes@keswork /etc/uwsgi/apps-available $ 
kalkehcoisa commented 8 years ago

I bumped on the same error message and problem here. Once I fixed the chdir everything started working smoothly.

I was running uwsgi using uwsgi --ini testing.ini to check if everything was ok with my config file and project.

This is the error I was getting:

Starting uWSGI 2.0.7-debian (64bit) on [Fri May 13 10:35:39 2016] compiled with version: 5.2.1 20150903 on 08 September 2015 19:33:31 os: Linux-4.2.0-36-generic #41-Ubuntu SMP Mon Apr 18 15:49:10 UTC 2016 nodename: jayme-MacBookPro machine: x86_64 clock source: unix pcre jit disabled detected number of CPU cores: 4 current working directory: /home/jayme/projetos/testing/install/uwsgi detected binary path: /usr/bin/uwsgi-core chdir(): No such file or directory [core/uwsgi.c line 2537]

And this is everything running fine after I corrected the chdir:

Starting uWSGI 2.0.7-debian (64bit) on [Fri May 13 10:27:33 2016] compiled with version: 5.2.1 20150903 on 08 September 2015 19:33:31 os: Linux-4.2.0-36-generic #41-Ubuntu SMP Mon Apr 18 15:49:10 UTC 2016 nodename: jayme-MacBookPro machine: x86_64 clock source: unix pcre jit disabled detected number of CPU cores: 4 current working directory: /home/jayme/projetos/testing/install/uwsgi detected binary path: /usr/bin/uwsgi-core your processes number limit is 14907 your memory page size is 4096 bytes detected max file descriptor number: 1024 lock engine: pthread robust mutexes thunder lock: disabled (you can enable it with --thunder-lock) uwsgi socket 0 bound to UNIX address /var/www/testing/uwsgi.sock fd 3 Python version: 2.7.10 (default, Oct 14 2015, 16:09:02) [GCC 5.2.1 20151010] Set PythonHome to /var/virtual_envs/testing Python main interpreter initialized at 0x14ec610 python threads support enabled your server socket listen backlog is limited to 100 connections your mercy for graceful operations on workers is 60 seconds mapped 145536 bytes (142 KB) for 1 cores Operational MODE: single process WSGI app 0 (mountpoint='') ready in 12 seconds on interpreter 0x14ec610 pid: 7142 (default app) uWSGI is running in multiple interpreter mode spawned uWSGI master process (pid: 7142) spawned uWSGI worker 1 (pid: 7152, cores: 1)

This is my configuration file:

[uwsgi] socket = /var/www/testing/uwsgi.sock chmod-socket = 775

binary-path = /etc/init.d/uwsgi

chdir = /var/www/testing/testing/testing master = true virtualenv = /var/virtual_envs/testing module = testing:main uid = www-data gid = www-data processes = 1 threads = 1 plugins = python, logfile

logger = file:/var/log/uwsgi/app/testing.log

Thank you!

unbit commented 8 years ago

@kalkehcoisa sorry i do not get your report, the wrong configuration correctly reports a non-existent directory

kalkehcoisa commented 8 years ago

Yes, it says. But doesn't say what file is missing. The only reference to a file is "[core/uwsgi.c line 2537]". The problem is that the file has references to many other files, I got lost trying to discover which one was wrong and lost a lot of time. Even checked if core/uwsgi.c exists. Yeah... I know it makes absolutely no sense to point a line of a non-existent file... But I'm no expert in uwsgi, so I checked even the dumbest possibilities.

Anyway, thanks!