Dave, thanks, I have about 6 CGI's regularly appearing as hung.
Some show up only once a week.

The guestbook.cgi is very high traffic. A sweet spot for spammmers
and I don't know what happens if someone tries to dump a huge
chunk of data into the comments field (I used to see that a lot
before we implemented the captcha visual check) he regularly hangs
at least once in 72 hours... so I will test this solution on that one
and if it doesn't appear again in one week we know we nailed it.

Questions below....

ps. to Bernard... suggestion on logs. good one! I'll do it. tks

At least this dual XEON box has four CPU's....otherwise
our web site(s) would have died a long time ago on this problem.

On 5 May 2007, at 23:09, Sivakatirswami wrote:


    repeat until length(PostIn) >= $CONTENT_LENGTH
        read from stdin until ""
            put it after PostIn
      end repeat


Dave Cragg wrote:

I'd suspect this part. I used to use this approach, but ran into trouble after moving some scripts to a new server. If something happens to stall the connection during the read process, you'll be in an endless loop, possibly with high CPU usage.

I've started using something like this. It puts a limit on how many "empty reads" happen before bailing out. (I copied this quickly, and modified slightly to remove some application specific code. Check before using.):

local sPostdata = ""
local sDataRead = false
local sReadCount = 0
local sEmptyReadCount = 0
local sEmptyReadLimit = 200
local sShortRead = false


on startup

 readData
 repeat while sDataRead = false
    wait for messages
  end repeat

## skts: I don't understand "wait for messages" what does that do?

## The rest of this is quite transparent.


  if sShortRead then
       ## exit routine needed here

# a good place to use Bernard's log suggestion...
# which will also help confirm that this is the culprit.


  end if

  ## carry on

end startup

on readData
   read from stdin for $CONTENT_LENGTH
   put it into tTemp
   add 1 to sReadCount
   if tTemp <> empty then
     put tTemp after sPostdata
    else
      add 1 to sEmptyReadCount

   end if
   if length(sPostdata) < $CONTENT_LENGTH then
     if sEmptyReadCount < sEmptyReadLimit then
       send readData to me in 50 milliseconds
     else
       put true into sDataRead
       put true into sShortRead
     end if
   else
     put true into sDataRead
   end if
end readData
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


--
Om shanti
(In  Peace)

Sivakatirswami
www.himalayanacademy.com

Get Hinduism Today Digital Edition. It's Free!
http://www.hinduismtoday.com/digital/
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to