Embedding D Shared Library in WSGI Web Server

John McFarlane via Digitalmars-d digitalmars-d at puremagic.com
Fri Nov 7 15:30:46 PST 2014


On Friday, 7 November 2014 at 22:14:41 UTC, Laeeth Isharc wrote:
> since you didn't get an answer.
>
> https://code.google.com/p/modwsgi/wiki/ProcessesAndThreading
>
>
> you can turn off threads and processes to aid debugging:
>
> https://code.google.com/p/modwsgi/wiki/ProcessesAndThreading
>
>
> StartServers 1
> ServerLimit 1
>
> With this configuration, only one process will be started, with 
> no additional processes ever being created. The WSGI 
> environment key/value pairs indicating how processes and 
> threads are being used will for this configuration be as 
> follows.
>
> wsgi.multithread	False
> wsgi.multiprocess	False
>
> In effect, this configuration has the result of serialising all 
> requests through a single process. This will allow an 
> interactive browser based debugger to be used, but may prevent 
> more complex WSGI applications which make use of AJAX 
> techniques from working. This could occur where a web page 
> initiates a sequence of AJAX requests and expects later 
> requests to be able to complete while a response for an initial 
> request is still pending. In other words, problems may occur 
> where requests overlap, as subsequent requests will not be able 
> to be executed until the initial request has completed.
> -----
> although obviously that is not a solution to your problem, it 
> might help pinpoint it.
>
> did you try tracking init state in your library and have entry 
> points call D runtime if not already initialized?

Thanks. I'll use that information about WSGI to test whether it 
really is a thread/process issue. Multiple requests causing 
re-entry definitely isn't the problem yet but worth being wary of 
down the road. Also intrigued by the idea of using a 
browser-based debugger.

I tried a variety of combinations of initialize and terminate but 
not specifically calling initialize from the request thread only 
once and without calling terminate. I'll give that a go but I'm 
no too hopeful as initialize/terminate pairs don't work, 
initialize from the start-up thread doesn't work and the docs are 
unclear whether initialize doesn't already do said state checking 
for me.


More information about the Digitalmars-d mailing list