Re: perl FCGI segmentation fault using ithreads ...
Sam Vilain <sam-s9IUA/[email protected]>
| Newsgroups | gmane.comp.web.fastcgi.devel |
|---|---|
| Message-ID | <[email protected]> |
Sven Verdoolaege wrote: >>Master perl >> -> load FCGI >> -> create FCGI handle >> -> accept FCGI socket >> -> create new interpreter thread >> ->request >> ->request >> >> > >What does "request" refer to ? > > It refers to $request->accept(), that there are two represents that the multiplicity is happening at that level. >>If threading is giving you segfaults, it is a fairly safe bet that the >>FCGI.pm module is not re-entrant. >> >> > >Not sure what you mean here, but the FCGI module should be thread-safe, >if you're using the thread-safe interface. >Which our friend, btw, isn't. > > Well, there you have it. If you use the non-thread safe version of the FCGI module, you get non-rentrant-like bugs :-). Igor, in the FCGI.pm distribution there is a file called threaded.PL, which is built into threaded.fpl by the module build process. This script does several things which no doubt add to the reentrancy of the code: - creates a new thread before creating a new FastCGI request object - uses localised filehandles for input, output, error and the process environment. The script can be browsed at http://search.cpan.org/src/SKIMO/FCGI-0.67/threaded.PL You might be hard pressed to find a module that can extract CGI requests without assuming that it's safe to read %ENV and/or standard input. I had to write one myself, it's on (or will shortly be on) CPAN at; http://search.cpan.org/dist/PSA/ The PSA::Request::CGI is the one that will encapsulate the input request. You might even be able to use the acceptor class in a threaded environment. Sam. ___________________________________ fastcgi-developers mailing list http://fastcgi.com/fastcgi-developers/