dependent applications (daemon process) hang in one Virtual Host?

12 views
Skip to first unread message

caregraf

unread,
Nov 8, 2010, 10:48:56 PM11/8/10
to modwsgi
Define one virtual host: www.example.com and put in it, two wsgi
applications. The second uses the first (and other endpoints). So:

WSGIDaemonProcess app1 processes=1 display-name=%{GROUP}
WSGIProcessGroup app1
WSGIScriptAlias /app1EP /usr/local/app1/app1EP.wsgi

WSGIDaemonProcess app2 processes=1 display-name=%{GROUP}
WSGIProcessGroup app2
WSGIScriptAlias /app2EP /usr/local/app2/app2EP.wsgi <---------- this
calls /app1EP and other endpts

1) App1 works fine
2) App2 can call endpoints outside www.example.com BUT it hangs
calling app1 - www.example.com/app1

When I move App2 off to its own Virtual host - app2.example.com -
everything works fine.

Is there some setting that would let me leave app2 inside www.example.com,
as a peer of app1?

Thanks.

Graham Dumpleton

unread,
Nov 8, 2010, 10:57:52 PM11/8/10
to mod...@googlegroups.com

Whether that will work or not depends on what Apache MPM you are using
and how you have it configured.

It also depends on what 'other endpts' is. Are these with App2, or
other external sites?

So, what MPM are you using. See:

http://code.google.com/p/modwsgi/wiki/CheckingYourInstallation#Apache_Build_Information

for how to work that out.

Also, what are the MPM settings being used. Ie., what do you have for:

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_prefork_module>
StartServers 1
MinSpareServers 1
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 0
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_worker_module>
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>

If the Apache MPM settings are such that there are limited
processes/threads for handling requests, then doing loopback HTTP
request against the same server will deadlock or stall when done when
all processes/threads are busy handling requests, or busy handing keep
alive connections.

Why do you need to do a HTTP get back against other application hosted
on same Apache?

Graham

caregraf

unread,
Nov 9, 2010, 1:09:26 AM11/9/10
to modwsgi
Graham,

App2 calls App1 AND calls 3rd party end points too. The latter works,
no problem. But calling App1, when it is in the same host, doesn't
work.

The reason for the app1, app2 split is that many clients use app1 - it
is a basic query service on a Graph (RDF) store. App2 does a bunch of
rollups, fixed queries to produce a very particular type of report.
Why the same domain? Yes, I could have app2.example.com and then
app3.example.com ... but I wanted to know if I could just have
www.example.com/app2EP etc.

MPM? APACHE_MPM_DIR="server/mpm/worker".

<IfModule mpm_worker_module>
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>

Nothing jumps out ...

Conor

On Nov 8, 7:57 pm, Graham Dumpleton <graham.dumple...@gmail.com>
wrote:
> On 9 November 2010 14:48, caregraf <careg...@gmail.com> wrote:
>
>
>
> > Define one virtual host:www.example.comand put in it, two wsgi
> > applications. The second uses the first (and other endpoints). So:
>
> > WSGIDaemonProcess app1 processes=1 display-name=%{GROUP}
> > WSGIProcessGroup app1
> > WSGIScriptAlias /app1EP /usr/local/app1/app1EP.wsgi
>
> > WSGIDaemonProcess app2 processes=1 display-name=%{GROUP}
> > WSGIProcessGroup app2
> > WSGIScriptAlias /app2EP /usr/local/app2/app2EP.wsgi <---------- this
> > calls /app1EP and other endpts
>
> > 1) App1 works fine
> > 2) App2 can call endpoints outsidewww.example.comBUT it hangs
> > calling app1 -  www.example.com/app1
>
> > When I move App2 off to its own Virtual host - app2.example.com -
> > everything works fine.
>
> > Is there some setting that would let me leave app2 insidewww.example.com,
> > as a peer of app1?
>
> Whether that will work or not depends on what Apache MPM you are using
> and how you have it configured.
>
> It also depends on what 'other endpts' is. Are these with App2, or
> other external sites?
>
> So, what MPM are you using. See:
>
>  http://code.google.com/p/modwsgi/wiki/CheckingYourInstallation#Apache...

Graham Dumpleton

unread,
Nov 9, 2010, 5:02:27 AM11/9/10
to mod...@googlegroups.com
Use WSGI application wrapper in:

http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Tracking_Request_and_Response

to track calls into application and subsequent exit. See if the sub
call actually makes it to the second WSGI application.

One possibility is that both applications need to acquire a lock of
some sort on a resource and when making the call to the second, the
first isn't releasing that resource so when second gets request it
blocks waiting for resource to be released, but that will never happen
as first application will only do that when second returns, which it
will not be because it is blocked.

Graham

> --
> You received this message because you are subscribed to the Google Groups "modwsgi" group.
> To post to this group, send email to mod...@googlegroups.com.
> To unsubscribe from this group, send email to modwsgi+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
>
>

Reply all
Reply to author
Forward
0 new messages