Why Dancer app fails under uWSGI + Apache?
Asked Answered
A

1

6

My Dancer app fails under uWSGI (2.0.7) + Apache (2.4.10) combination while it runs freely in other environments ( uWSGI + nginx, Starman + Apache, Dancer own dev-server). I don't find in logs any meaningful information. So I made simple test app like

$ dancer -a tset

Then copied default production.yml into uwsgi.yml, linked bin/app.pl into bin/app.psgi created tset.ini like this:

[uwsgi]                                                                                                                                                                             
plugins   = psgi                                                                                                                                                                    
socket    = 127.0.0.1:3033                                                                                                                                                          
uid       = www                                                                                                                                                                     
gid       = www-data                                                                                                                                                                
chdir     = /home/www/apps/tset/bin/                                                                                                                                                
psgi      = app.psgi                                                                                                                                                                
processes = 1                                                                                                                                                                       
master    = true  

Made this ini available for uWsgi in /etc/uwsgi/apps-available, linked it into /etc/uwsgi/apps-enabled.

Restarted uwsgi service.

Then for Apache (2.4.10) module mod-proxy-uwsgi added few lines into my virtualhost conf:

ProxyPass /adm/y uwsgi://127.0.0.1:3033/

This seems most fragile point, because I feel like I need to set uWSGIModifier1 5 here but did not figured out where and how?

Restarted Apache and got "Internal Server Error". In uwsgi log I see just:

Tue Jan 19 02:10:36 2016 - spawned uWSGI worker 1 (pid: 21712, cores: 1)
Tue Jan 19 02:10:56 2016 - -- unavailable modifier requested: 0 --
Tue Jan 19 02:24:44 2016 - -- unavailable modifier requested: 0 --
Tue Jan 19 02:27:14 2016 - -- unavailable modifier requested: 0 --
Tue Jan 19 02:27:17 2016 - -- unavailable modifier requested: 0 --

What is this "unavailable modifier requested"?

In apache error.log is no entries, in access.log are entries, but no other information than status 500.

Such behavior is reproducible with steps above, so I hope you figure out, what is wrong in this combination?

Ameline answered 19/1, 2016 at 0:46 Comment(0)
S
4

I feel like I need to set uWSGIModifier1 5 here but did not figured out where and how?

Yes, you're right. You should set modifier1 to 5, but uwsgi docs says about mod_proxy_uwsgi:

Currently the module lacks the ability to set modifiers, though this will be fixed soon.

That means, you can't pass modifier to uWSGI instance using this method (uWSGI will use modifier 0 if not supplied)

To fix that issue, you can move to mod_uwsgi or change modifier on which psgi is loaded, using:

plugins   = 0:psgi

instead of

plugins   = psgi
Sweep answered 19/1, 2016 at 16:28 Comment(2)
Sorry for delay. This was good hint and after moving to the 0:psgi I have a little progress. In uwsgi log is now --- unable to find perl application --- and another messy line [pid: 5757|app: -1|req: -1/1] 212.7.22.161 () {66 vars in 1511 bytes} [Sat Jan 23 00:07:15 2016] GET /adm/z/ => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0) Here I see, that resonse is 21 bytes, what is length of "Internal server error". Do you have any hints more, why Perl app is not found under Apache here?Ameline
Found out, that www-data usesr did not have same @INC, that's why Perl app was not found. So I got uwsgi run under Apache2 too. Thank you!Ameline

© 2022 - 2024 — McMap. All rights reserved.