Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: [FCGI.pm] - not threads-safe?

by BrowserUk (Pope)
on Aug 19, 2013 at 19:03 UTC ( #1050069=note: print w/ replies, xml ) Need Help??


in reply to [FCGI.pm] - not threads-safe?

This bug prevent use FCGI.pm with threads. Does somebody has a working solution to use FCGI in main thread?

It isn't a bug. It means that FCGI is not thread-safe.

And given what FCGI does:

Instead of creating a new process for each request, FastCGI uses persistent processes to handle a series of requests. These processes are owned by the FastCGI server, not the web server. 1

To service an incoming request, the web server sends environment information and the page request itself to a FastCGI process over a socket (in the case of local FastCGI processes on the web server) or TCP connection (for remote FastCGI processes in a server farm). Responses are returned from the process to the web server over the same connection, and the web server subsequently delivers that response to the end-user. The connection may be closed at the end of a response, but both the web server and the FastCGI service processes persist.2

Each individual FastCGI process can handle many requests over its lifetime, thereby avoiding the overhead of per-request process creation and termination. Processing of multiple requests simultaneously can be achieved in several ways: by using a single connection with internal multiplexing (i.e. multiple requests over a single connection); by using multiple connections; or by a combination of these techniques. Multiple FastCGI servers can be configured, increasing stability and scalability.

it almost certainly could never be thread-safe.

If you describe why you think you need threads, maybe we can help.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.


Comment on Re: [FCGI.pm] - not threads-safe?
Re^2: [FCGI.pm] - not threads-safe?
by zdm (Sexton) on Aug 20, 2013 at 10:29 UTC

    I need FCGI.pm in threads because this is a single way to create preforking fcgi server, which can process parallel requests under window.

    FCGI.pm just listen socket, accept connection and populate the environment hash.

    Why it could never be threads safe? It's perfectly work in threads under MSWin and Linux, except segfault when thread has been destroyed.

      It's perfectly work in threads ... except segfault when thread

      Tada!


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

        It mean, that FCGI.pm MUST have properly implemented cleanup routine, that cleanup used resources in right way, and a public method to call this routine.

        My question was - is there anybody solve this problem?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1050069]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (14)
As of 2014-07-31 19:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (251 votes), past polls