1 (edited by Dominique 2015-06-27 01:47:09)

Topic: 502 Bad Gateway trying to access iRedAdminPro

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

When trying to access the iredadmin page Nginx throws a 502 Bad Gateway.

/var/log/ngingx/error.log shows:

2015/06/26 18:21:50 [crit] 2598#0: *6 connect() to unix:/run/uwsgi/iredadmin.socket failed (2: No such file or directory) while connecting to upstream, client: 88.9.98.185, server: _, request: "GET /iredadmin HTTP/1.1", upstream: "uwsgi://unix:/run/uwsgi/iredadmin.socket:", host: "email.xxxxxxxx.yy"

and running "service uwsgi status" gives

Redirecting to /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 Fri 2015-06-26 18:24:29 BST; 38s ago
  Process: 2804 ExecStart=/usr/sbin/uwsgi --ini /etc/uwsgi.ini (code=exited, status=0/SUCCESS)
  Process: 2802 ExecStartPre=/bin/chown uwsgi:uwsgi /run/uwsgi (code=exited, status=0/SUCCESS)
  Process: 2801 ExecStartPre=/bin/mkdir -p /run/uwsgi (code=exited, status=0/SUCCESS)
 Main PID: 2804 (code=exited, status=0/SUCCESS)
   Status: "initializing uWSGI"

Jun 26 18:24:29 email.xxxxxxxx.yy systemd[1]: Started uWSGI Emperor Service.
Jun 26 18:24:29 email.xxxxxxxx.yy systemd[1]: uwsgi.service holdoff time over, scheduling restart.
Jun 26 18:24:29 email.xxxxxxxx.yy systemd[1]: Stopping uWSGI Emperor Service...
Jun 26 18:24:29 email.xxxxxxxx.yy systemd[1]: Starting uWSGI Emperor Service...
Jun 26 18:24:29 email.xxxxxxxx.yy systemd[1]: uwsgi.service start request repeated too quickly, refusing to start.
Jun 26 18:24:29 email.xxxxxxxx.yy systemd[1]: Failed to start uWSGI Emperor Service.
Jun 26 18:24:29 email.xxxxxxxx.yy systemd[1]: Unit uwsgi.service entered failed state.

it's a fresh installation by the way (as part of test for upgrading an old version... yes, still)

nginx and php-fpm seem to be running fine, as roundcubemail is working

EDIT:
/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

----

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

2

Re: 502 Bad Gateway trying to access iRedAdminPro

What's the content in file /etc/uwsgi.d/iredadmin.ini?

Default is:

[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

3

Re: 502 Bad Gateway trying to access iRedAdminPro

It's identical to the default:

[root@email ~]# 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

It was on a clean install using the latest version and I didn't change any config files.  I'm gonna start the entire installation again from scratch now, see if it happens again. 

By the way, dsandor seems to have the same problem in this thread: http://www.iredmail.org/forum/topic9241 … teway.html (the 8th post on the thread)

I'll let you know what the new installation brings later today.

4

Re: 502 Bad Gateway trying to access iRedAdminPro

If it doesn't work, please comment out 'daemonize' line in /etc/uwsgi.ini, start uwsgi from command line directly, don't use 'systemctl', then show me terminal output.

# uwsgi --ini /etc/uwsgi.ini

5 (edited by Dominique 2015-06-29 17:17:04)

Re: 502 Bad Gateway trying to access iRedAdminPro

I saw your reply before I restarted the process and tried removing the daemonize parameter and it worked! 

iredadmin now seems to be starting as it should and works as expected.

I also tried rebooting the server and uwsgi started without any problem as well.

Is this something permanent I can continue with?

6 (edited by Dominique 2015-06-29 17:16:33)

Re: 502 Bad Gateway trying to access iRedAdminPro

I missed the part about which output you wanted, sorry about that, here it is:

[uWSGI] getting INI configuration from /etc/uwsgi.ini
Mon Jun 29 10:13:25 2015 - *** Starting uWSGI 2.0.9 (64bit) on [Mon Jun 29 10:13:25 2015] ***
Mon Jun 29 10:13:25 2015 - compiled with version: 4.8.3 20140911 (Red Hat 4.8.3-9) on 23 April 2015 19:50:42
Mon Jun 29 10:13:25 2015 - os: Linux-3.10.0-123.8.1.el7.x86_64 #1 SMP Mon Sep 22 19:06:58 UTC 2014
Mon Jun 29 10:13:25 2015 - nodename: email.xxxxxxxxxx.yy
Mon Jun 29 10:13:25 2015 - machine: x86_64
Mon Jun 29 10:13:25 2015 - clock source: unix
Mon Jun 29 10:13:25 2015 - pcre jit disabled
Mon Jun 29 10:13:25 2015 - detected number of CPU cores: 1
Mon Jun 29 10:13:25 2015 - current working directory: /root
Mon Jun 29 10:13:25 2015 - writing pidfile to /run/uwsgi/uwsgi.pid
Mon Jun 29 10:13:25 2015 - detected binary path: /usr/sbin/uwsgi
Mon Jun 29 10:13:25 2015 - uWSGI running as root, you can use --uid/--gid/--chroot options
Mon Jun 29 10:13:25 2015 - *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
Mon Jun 29 10:13:25 2015 - your processes number limit is 7870
Mon Jun 29 10:13:25 2015 - your memory page size is 4096 bytes
Mon Jun 29 10:13:25 2015 - detected max file descriptor number: 1024
Mon Jun 29 10:13:25 2015 - lock engine: pthread robust mutexes
Mon Jun 29 10:13:25 2015 - thunder lock: disabled (you can enable it with --thunder-lock)
Mon Jun 29 10:13:25 2015 - uwsgi socket 0 bound to UNIX address /var/run/uwsgi.socket fd 3
Mon Jun 29 10:13:25 2015 - your server socket listen backlog is limited to 100 connections
Mon Jun 29 10:13:25 2015 - your mercy for graceful operations on workers is 60 seconds
Mon Jun 29 10:13:25 2015 - mapped 218304 bytes (213 KB) for 2 cores
Mon Jun 29 10:13:25 2015 - *** Operational MODE: preforking ***
Mon Jun 29 10:13:25 2015 - *** no app loaded. going in full dynamic mode ***
Mon Jun 29 10:13:25 2015 - *** uWSGI is running in multiple interpreter mode ***
Mon Jun 29 10:13:25 2015 - spawned uWSGI master process (pid: 2889)
Mon Jun 29 10:13:25 2015 - spawned uWSGI worker 1 (pid: 2891, cores: 1)
Mon Jun 29 10:13:25 2015 - spawned uWSGI worker 2 (pid: 2892, cores: 1)
Mon Jun 29 10:13:25 2015 - *** starting uWSGI Emperor ***
*** has_emperor mode detected (fd: 6) ***
[uWSGI] getting INI configuration from iredadmin.ini
*** Starting uWSGI 2.0.9 (64bit) on [Mon Jun 29 10:13:25 2015] ***
compiled with version: 4.8.3 20140911 (Red Hat 4.8.3-9) on 23 April 2015 19:50:42
os: Linux-3.10.0-123.8.1.el7.x86_64 #1 SMP Mon Sep 22 19:06:58 UTC 2014
nodename: email.xxxxxxxxxx.yy
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
your processes number limit is 7870
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 0x6e4920
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 ***
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 2893)
spawned uWSGI worker 1 (pid: 2894, cores: 1)
Mon Jun 29 10:13:25 2015 - [emperor] vassal iredadmin.ini has been spawned
Mon Jun 29 10:13:25 2015 - [emperor] vassal iredadmin.ini is ready to accept requests

and after pressing ^C

Mon Jun 29 10:13:32 2015 - [emperor] *** RAGNAROK EVOKED ***
Mon Jun 29 10:13:32 2015 - [emperor] stop the uwsgi instance iredadmin.ini
Mon Jun 29 10:13:32 2015 - SIGINT/SIGQUIT received...killing workers...
Mon Jun 29 10:13:32 2015 - waiting for Emperor death...
Mon Jun 29 10:13:32 2015 - [emperor] *** RAGNAROK ALREADY EVOKED (mercyless in 30 seconds)***
SIGINT/SIGQUIT received...killing workers...
Mon Jun 29 10:13:32 2015 - received message 0 from emperor
Mon Jun 29 10:13:33 2015 - waiting for Emperor death...
worker 1 buried after 1 seconds
goodbye to uWSGI.
Mon Jun 29 10:13:34 2015 - waiting for Emperor death...
Mon Jun 29 10:13:34 2015 - [emperor] removed uwsgi instance iredadmin.ini
Mon Jun 29 10:13:35 2015 - waiting for Emperor death...
Mon Jun 29 10:13:35 2015 - The Emperor is buried.
Mon Jun 29 10:13:36 2015 - The Emperor has been buried (pid: 2890)
Mon Jun 29 10:13:36 2015 - worker 1 buried after 4 seconds
Mon Jun 29 10:13:36 2015 - worker 2 buried after 4 seconds
Mon Jun 29 10:13:36 2015 - goodbye to uWSGI.

7

Re: 502 Bad Gateway trying to access iRedAdminPro

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