1 (edited by window 2015-08-30 00:00:24)

Topic: uWSGI start problem

======== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.2
- Linux/BSD distribution name and version: CentOS Linux release 7.1.1503
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro?
- Related log if you're reporting an issue:
====
Hello.

I can't start uWSGI. What may be the problem?

Thank you.

# cat /var/log/uwsgi/uwsgi.log 
Sat Aug 29 11:59:08 2015 - *** Starting uWSGI 2.0.11.1 (64bit) on [Sat Aug 29 11:59:08 2015] ***
Sat Aug 29 11:59:08 2015 - compiled with version: 4.8.3 20140911 (Red Hat 4.8.3-9) on 21 July 2015 16:01:10
Sat Aug 29 11:59:08 2015 - os: Linux-3.10.0-123.8.1.el7.x86_64 #1 SMP Mon Sep 22 19:06:58 UTC 2014
Sat Aug 29 11:59:08 2015 - nodename: xxx.main
Sat Aug 29 11:59:08 2015 - machine: x86_64
Sat Aug 29 11:59:08 2015 - clock source: unix
Sat Aug 29 11:59:08 2015 - pcre jit disabled
Sat Aug 29 11:59:08 2015 - detected number of CPU cores: 1
Sat Aug 29 11:59:08 2015 - current working directory: /
Sat Aug 29 11:59:08 2015 - writing pidfile to /run/uwsgi/uwsgi.pid
Sat Aug 29 11:59:08 2015 - detected binary path: /usr/sbin/uwsgi
Sat Aug 29 11:59:08 2015 - uWSGI running as root, you can use --uid/--gid/--chroot options
Sat Aug 29 11:59:08 2015 - *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
Sat Aug 29 11:59:08 2015 - your processes number limit is 3839
Sat Aug 29 11:59:08 2015 - your memory page size is 4096 bytes
Sat Aug 29 11:59:08 2015 - detected max file descriptor number: 1024
Sat Aug 29 11:59:08 2015 - lock engine: pthread robust mutexes
Sat Aug 29 11:59:08 2015 - thunder lock: disabled (you can enable it with --thunder-lock)
Sat Aug 29 11:59:08 2015 - uwsgi socket 0 bound to UNIX address /var/run/uwsgi.socket fd 4
Sat Aug 29 11:59:08 2015 - your server socket listen backlog is limited to 100 connections
Sat Aug 29 11:59:08 2015 - your mercy for graceful operations on workers is 60 seconds
Sat Aug 29 11:59:08 2015 - mapped 218304 bytes (213 KB) for 2 cores
Sat Aug 29 11:59:08 2015 - *** Operational MODE: preforking ***
Sat Aug 29 11:59:08 2015 - *** no app loaded. going in full dynamic mode ***
Sat Aug 29 11:59:08 2015 - *** uWSGI is running in multiple interpreter mode ***
Sat Aug 29 11:59:08 2015 - spawned uWSGI master process (pid: 3674)
Sat Aug 29 11:59:08 2015 - spawned uWSGI worker 1 (pid: 3676, cores: 1)
Sat Aug 29 11:59:08 2015 - spawned uWSGI worker 2 (pid: 3677, cores: 1)
Sat Aug 29 11:59:08 2015 - SIGINT/SIGQUIT received...killing workers...
Sat Aug 29 11:59:08 2015 - waiting for Emperor death...
Sat Aug 29 11:59:08 2015 - !!! uWSGI process 3675 got Segmentation Fault !!!
Sat Aug 29 11:59:08 2015 - *** backtrace of 3675 ***
/usr/sbin/uwsgi(uwsgi_backtrace+0x2e) [0x46576e]
/usr/sbin/uwsgi(uwsgi_segfault+0x21) [0x465b31]
/lib64/libc.so.6(+0x35650) [0x7f3ed2985650]
/usr/sbin/uwsgi() [0x431a47]
/lib64/libpthread.so.0(+0xf130) [0x7f3ed4890130]
/lib64/libc.so.6(realpath+0) [0x7f3ed2992530]
/usr/sbin/uwsgi(uwsgi_imperial_monitor_directory_init+0x44) [0x433164]
/usr/sbin/uwsgi(emperor_build_scanners+0x3b) [0x4333bb]
/usr/sbin/uwsgi(emperor_loop+0x145) [0x433cc5]
/usr/sbin/uwsgi(uwsgi_emperor_start+0xe8) [0x434878]
/usr/sbin/uwsgi(uwsgi_start+0x35d) [0x466bad]
/usr/sbin/uwsgi(uwsgi_setup+0x10f1) [0x468e81]
/usr/sbin/uwsgi(main+0x9) [0x4176c9]
/lib64/libc.so.6(__libc_start_main+0xf5) [0x7f3ed2971af5]
/usr/sbin/uwsgi() [0x4176f9]
*** end of backtrace ***
Sat Aug 29 11:59:09 2015 - The Emperor has been buried (pid: 3675)
Sat Aug 29 11:59:09 2015 - worker 1 buried after 1 seconds
Sat Aug 29 11:59:09 2015 - worker 2 buried after 1 seconds
Sat Aug 29 11:59:09 2015 - goodbye to uWSGI.


# ldd `which python`
        linux-vdso.so.1 =>  (0x00007fff2ebfe000)
        libpython2.7.so.1.0 => /lib64/libpython2.7.so.1.0 (0x00007fd95f443000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fd95f227000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007fd95f022000)
        libutil.so.1 => /lib64/libutil.so.1 (0x00007fd95ee1f000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fd95eb1d000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fd95e75b000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fd95f811000)
        
        
# ldd `which uwsgi`
        linux-vdso.so.1 =>  (0x00007fff09b4f000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f9720a1b000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f9720719000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f9720514000)
        libz.so.1 => /lib64/libz.so.1 (0x00007f97202fe000)
        libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f972009d000)
        libcap.so.2 => /lib64/libcap.so.2 (0x00007f971fe97000)
        libuuid.so.1 => /lib64/libuuid.so.1 (0x00007f971fc92000)
        libyaml-0.so.2 => /lib64/libyaml-0.so.2 (0x00007f971fa72000)
        libjansson.so.4 => /lib64/libjansson.so.4 (0x00007f971f865000)
        libssl.so.10 => /lib64/libssl.so.10 (0x00007f971f5f8000)
        libcrypto.so.10 => /lib64/libcrypto.so.10 (0x00007f971f211000)
        libxml2.so.2 => /lib64/libxml2.so.2 (0x00007f971eea7000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f971eae6000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f9720c3f000)
        libattr.so.1 => /lib64/libattr.so.1 (0x00007f971e8e1000)
        libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007f971e694000)
        libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007f971e3b1000)
        libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007f971e1ad000)
        libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007f971df7a000)
        liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f971dd55000)
        libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007f971db46000)
        libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007f971d941000)
        libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f971d727000)
        libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f971d501000)

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: uWSGI start problem

Does it work if you start it manually?

/usr/sbin/uwsgi --ini /etc/uwsgi.ini

# Or

/usr/sbin/uwsgi --ini /etc/uwsgi.d/iredadmin.ini

3

Re: uWSGI start problem

# /usr/sbin/uwsgi --ini /etc/uwsgi.ini

[uWSGI] getting INI configuration from /etc/uwsgi.ini
# ps xa|grep uws
 8203 ?        S      0:00 /usr/sbin/uwsgi --ini /etc/uwsgi.ini
 8204 ?        S      0:00 /usr/sbin/uwsgi --ini /etc/uwsgi.ini
 8205 ?        S      0:00 /usr/sbin/uwsgi --ini /etc/uwsgi.ini
 8206 ?        S      0:00 /usr/sbin/uwsgi --ini /etc/uwsgi.ini
 8207 ?        S      0:00 /usr/sbin/uwsgi --ini iredadmin.ini
 8208 ?        S      0:00 /usr/sbin/uwsgi --ini iredadmin.ini






# /usr/sbin/uwsgi --ini /etc/uwsgi.d/iredadmin.ini
[uWSGI] getting INI configuration from /etc/uwsgi.d/iredadmin.ini
*** Starting uWSGI 2.0.11.1 (64bit) on [Sat Aug 29 16:47:07 2015] ***
compiled with version: 4.8.3 20140911 (Red Hat 4.8.3-9) on 21 July 2015 16:01:10
os: Linux-3.10.0-123.8.1.el7.x86_64 #1 SMP Mon Sep 22 19:06:58 UTC 2014
nodename: xxx.main
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 1
current working directory: /etc/uwsgi.d
writing pidfile to /run/uwsgi/iredadmin.pid
detected binary path: /usr/sbin/uwsgi
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 3839
your memory page size is 4096 bytes
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 UNIX address /run/uwsgi/iredadmin.socket fd 3
setgid() to 2001
setuid() to 2001
Python version: 2.7.5 (default, Jun 24 2015, 00:41:19)  [GCC 4.8.3 20140911 (Red Hat 4.8.3-9)]
Python main interpreter initialized at 0x1b9bb70
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 72768 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 2718, cores: 1)

# ps xa|grep uw
 2718 pts/1    S+     0:00 /usr/sbin/uwsgi --ini /etc/uwsgi.d/iredadmin.ini



# /bin/systemctl start uwsgi.service
# ps xa|grep uw
 2741 pts/1    R+     0:00 grep --color=auto uw

# /bin/systemctl status  uwsgi.service  
uwsgi.service - uWSGI Emperor Service
   Loaded: loaded (/usr/lib/systemd/system/uwsgi.service; enabled)
   Active: failed (Result: start-limit) since Sat 2015-08-29 16:56:45 BST; 1min 6s ago
  Process: 2685 ExecStart=/usr/sbin/uwsgi --ini /etc/uwsgi.ini (code=exited, status=0/SUCCESS)
  Process: 2683 ExecStartPre=/bin/chown uwsgi:uwsgi /run/uwsgi (code=exited, status=0/SUCCESS)
  Process: 2682 ExecStartPre=/bin/mkdir -p /run/uwsgi (code=exited, status=0/SUCCESS)
 Main PID: 2685 (code=exited, status=0/SUCCESS)
   Status: "initializing uWSGI"

Aug 29 16:56:45 xxx.main systemd[1]: Started uWSGI Emperor Service.
Aug 29 16:56:45 xxx.main systemd[1]: uwsgi.service holdoff time over, scheduling restart.
Aug 29 16:56:45 xxx.main systemd[1]: Stopping uWSGI Emperor Service...
Aug 29 16:56:45 xxx.main systemd[1]: Starting uWSGI Emperor Service...
Aug 29 16:56:45 xxx.main systemd[1]: uwsgi.service start request repeated too quickly, refusing to start.
Aug 29 16:56:45 xxx.main systemd[1]: Failed to start uWSGI Emperor Service.
Aug 29 16:56:45 xxx.main systemd[1]: Unit uwsgi.service entered failed state.


# cat /var/log/uwsgi/uwsgi.log 

Sat Aug 29 16:56:32 2015 - *** Starting uWSGI 2.0.11.1 (64bit) on [Sat Aug 29 16:56:30 2015] ***
Sat Aug 29 16:56:32 2015 - compiled with version: 4.8.3 20140911 (Red Hat 4.8.3-9) on 21 July 2015 16:01:10
Sat Aug 29 16:56:32 2015 - os: Linux-3.10.0-123.8.1.el7.x86_64 #1 SMP Mon Sep 22 19:06:58 UTC 2014
Sat Aug 29 16:56:32 2015 - nodename: xxx.main
Sat Aug 29 16:56:32 2015 - machine: x86_64
Sat Aug 29 16:56:32 2015 - clock source: unix
Sat Aug 29 16:56:32 2015 - pcre jit disabled
Sat Aug 29 16:56:32 2015 - detected number of CPU cores: 1
Sat Aug 29 16:56:32 2015 - current working directory: /
Sat Aug 29 16:56:32 2015 - writing pidfile to /run/uwsgi/uwsgi.pid
Sat Aug 29 16:56:32 2015 - detected binary path: /usr/sbin/uwsgi
Sat Aug 29 16:56:32 2015 - uWSGI running as root, you can use --uid/--gid/--chroot options
Sat Aug 29 16:56:32 2015 - *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
Sat Aug 29 16:56:32 2015 - your processes number limit is 3839
Sat Aug 29 16:56:32 2015 - your memory page size is 4096 bytes
Sat Aug 29 16:56:32 2015 - detected max file descriptor number: 1024
Sat Aug 29 16:56:32 2015 - lock engine: pthread robust mutexes
Sat Aug 29 16:56:32 2015 - thunder lock: disabled (you can enable it with --thunder-lock)
Sat Aug 29 16:56:32 2015 - uwsgi socket 0 bound to UNIX address /var/run/uwsgi.socket fd 4
Sat Aug 29 16:56:32 2015 - your server socket listen backlog is limited to 100 connections
Sat Aug 29 16:56:32 2015 - your mercy for graceful operations on workers is 60 seconds
Sat Aug 29 16:56:32 2015 - *** starting uWSGI Emperor ***
Sat Aug 29 16:56:32 2015 - [emperor] *** RAGNAROK EVOKED ***
Sat Aug 29 16:56:32 2015 - [emperor] stop the uwsgi instance iredadmin.ini

4

Re: uWSGI start problem

Do you have 'uid =' and 'gid =' in /etc/uwsgi.ini? if yes, please comment out them and try again.

5

Re: uWSGI start problem

It is commented ...

6

Re: uWSGI start problem

OK, which one works?

*) /usr/sbin/uwsgi --ini /etc/uwsgi.ini
*) /usr/sbin/uwsgi --ini /etc/uwsgi.d/iredadmin.ini

Also, please show us content of file /etc/uwsgi.ini and /etc/uwsgi.d/iredadmin.ini?

7

Re: uWSGI start problem

ZhangHuangbin wrote:

OK, which one works?
*) /usr/sbin/uwsgi --ini /etc/uwsgi.ini
*) /usr/sbin/uwsgi --ini /etc/uwsgi.d/iredadmin.ini

both are working



# cat /etc/uwsgi.ini
[uwsgi]

# Run in background and log to file
daemonize = /var/log/uwsgi/uwsgi.log

# try to autoload appropriate plugin if "unknown" option has been specified
autoload = true

# enable master process manager
master = true

# spawn 2 uWSGI worker processes
workers = 2

# automatically kill workers on master's death
no-orphans = true

# write master's pid in file
pidfile = /run/uwsgi/uwsgi.pid

# bind to UNIX socket file
socket = /var/run/uwsgi.socket

# set mode of created UNIX socket
chmod-socket = 660

# place timestamps into log
log-date = true

# user identifier of uWSGI processes
#uid = uwsgi

# group identifier of uWSGI processes
#gid = uwsgi

# multi-app deployment
emperor = /etc/uwsgi.d
emperor-tyrant = false

# cat /etc/uwsgi.d/iredadmin.ini
[uwsgi]
plugins = python
vhost = true
socket = /run/uwsgi/iredadmin.socket
pidfile = /run/uwsgi/iredadmin.pid
chown-socket = nginx:nginx
chmod-socket = 660
uid = iredadmin
gid = iredadmin
enable-threads = true

8 (edited by vsolomatin 2015-09-02 21:52:30)

Re: uWSGI start problem

window wrote:
ZhangHuangbin wrote:

OK, which one works?
*) /usr/sbin/uwsgi --ini /etc/uwsgi.ini
*) /usr/sbin/uwsgi --ini /etc/uwsgi.d/iredadmin.ini

both are working



# cat /etc/uwsgi.ini
[uwsgi]

# Run in background and log to file
daemonize = /var/log/uwsgi/uwsgi.log

# try to autoload appropriate plugin if "unknown" option has been specified
autoload = true

# enable master process manager
master = true

# spawn 2 uWSGI worker processes
workers = 2

# automatically kill workers on master's death
no-orphans = true

# write master's pid in file
pidfile = /run/uwsgi/uwsgi.pid

# bind to UNIX socket file
socket = /var/run/uwsgi.socket

# set mode of created UNIX socket
chmod-socket = 660

# place timestamps into log
log-date = true

# user identifier of uWSGI processes
#uid = uwsgi

# group identifier of uWSGI processes
#gid = uwsgi

# multi-app deployment
emperor = /etc/uwsgi.d
emperor-tyrant = false

# cat /etc/uwsgi.d/iredadmin.ini
[uwsgi]
plugins = python
vhost = true
socket = /run/uwsgi/iredadmin.socket
pidfile = /run/uwsgi/iredadmin.pid
chown-socket = nginx:nginx
chmod-socket = 660
uid = iredadmin
gid = iredadmin
enable-threads = true

http://www.iredmail.org/forum/topic9459 … inpro.html

ZhangHuangbin wrote:

Please fix it by commenting out line 'daemonize =' /etc/uwsgi.ini. This will be fixed in next iRedMail release.

9

Re: uWSGI start problem

vsolomatin wrote:

http://www.iredmail.org/forum/topic9459 … inpro.html

ZhangHuangbin wrote:

Please fix it by commenting out line 'daemonize =' /etc/uwsgi.ini. This will be fixed in next iRedMail release.


thank you!