ghart has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

I'm using the following versions:
Perl version v5.6.0 for OpenSA/1.0.0 / Apache/1.3.14
(Win32) mod_perl/1.26 mod_ssl/2.7.2 OpenSSL/0.9.6

And if I try to run a page (.plx) which uses UserAgent to
do a GET of another page ON THIS SAME SERVER, the
request will timeout. If I go to a different server,
the GET works fine. Even if I introduce our local
proxy server (which isn't needed, but shouldn't hurt),
which caches the desired page, it will
work - sometimes (I expect when it's only responding
with the cache hit).

However, if that second page was another .plx, it *does*
actually execute - but the response never gets back to
the original requester.

I've seen some posts about socket problems in this area,
so I tried setting ThreadPerServer for Apache to
1 - but the GETs (or POSTs) still timeout.

Anyone have any clues for me?

Geoff

Replies are listed 'Best First'.
Re: timeout from UserAgent from mod_perl
by perrin (Chancellor) on Nov 20, 2001 at 03:35 UTC
    You can't do this on NT with mod_perl. The 1.x line of mod_perl doesn't support multiple threads, and since Apache on NT is multi-threaded that means you only get one request processing at a time.

    There are various things you could do. You could try FastCGI (mod_fastcgi) which doesn't have this problem on NT. You could run on some other OS. You could do an include or subrequest or something instead of making an HTTP request back to the same server.

      OK, I will look at FastCGI, but in particuliar, I wanted
      the DBI connection pooling mod_perl offers.

      However, just to be clear on this, only the first page
      was a .plx (mod_perl) script. No matter if the second page
      the GET is done to is a .html (static page) or
      another .plx, the result is the same. And if the second
      page *IS* a .plx, it *does* execute (I generate some
      logging) normally - only its response seems to be lost.

      I was thinking the multi-threading was working, except for
      the socket stuff, which (as I mentioned) might be suspect.

      Geoff
        mod_perl does not offer connection "pooling" exactly. It simply keeps connections persistent. You can do something similar in FastCGI by putting your database connections into a global and leaving them open, or using the connect_cached method of DBI.

        If you've set the threads to 1, you'll have problems no matter what kind of page you're fetching. If you haven't, the socket stuff will give you trouble.

        If you really want to use mod_perl, I strongly suggest you look at how to get rid of this need for LWP requests. It's going to be a performance killer, and you can probably do it with a subrequest or something.