Loading ...
Sorry, an error occurred while loading the content.

setitimer Problem with SOAP::Lite

Expand Messages
  • Klaus Guenter
    Hi, List! I have written a little SOAP Server using SOAP::Transport::HTTP It forks off in to background and works smoothly so far. As a watchdog functionality,
    Message 1 of 2 , Feb 17, 2004
    • 0 Attachment
      Hi, List!

      I have written a little SOAP Server using SOAP::Transport::HTTP
      It forks off in to background and works smoothly so far.

      As a watchdog functionality, the server touches a certain file every 60 secs.
      Another process keeps monitoring the mtime of these files and kills/restarts
      processes that didn't touch their file for > 121 secs.

      <CODE>
      $SIG{ALRM} = sub {
      &SaveIntoFile("$watch_prefix.$my_port", 1);
      };

      #This is called after fork to set the timer on a per process basis
      setitimer(ITIMER_REAL, 10, 60);
      </CODE>

      Other server processes (not using SOAP::*) have no problems with this
      approach, while the signal handler in the server using SOAP::* is called only
      once after $daemon->handle . What did I miss? Is SOAP::* using itimer itself?

      Any hint is appreciated,
      TIA

      Klaus
      --
      People often find it easier to be a result of the past than a cause of
      the future.
      -
    • jpeyser
      The reason might be that the daemon handle is in blocking mode. Try setting it to non-blocking and then calling the handle routine using a timer. Jonathan ...
      Message 2 of 2 , Feb 17, 2004
      • 0 Attachment
        The reason might be that the daemon handle is in blocking mode. Try
        setting it to non-blocking and then calling the handle routine using
        a timer.

        Jonathan

        --- In soaplite@yahoogroups.com, Klaus Guenter <klaus.guenter@p...>
        wrote:
        > Hi, List!
        >
        > I have written a little SOAP Server using SOAP::Transport::HTTP
        > It forks off in to background and works smoothly so far.
        >
        > As a watchdog functionality, the server touches a certain file
        every 60 secs.
        > Another process keeps monitoring the mtime of these files and
        kills/restarts
        > processes that didn't touch their file for > 121 secs.
        >
        > <CODE>
        > $SIG{ALRM} = sub {
        > &SaveIntoFile("$watch_prefix.$my_port", 1);
        > };
        >
        > #This is called after fork to set the timer on a per process basis
        > setitimer(ITIMER_REAL, 10, 60);
        > </CODE>
        >
        > Other server processes (not using SOAP::*) have no problems with
        this
        > approach, while the signal handler in the server using SOAP::* is
        called only
        > once after $daemon->handle . What did I miss? Is SOAP::* using
        itimer itself?
        >
        > Any hint is appreciated,
        > TIA
        >
        > Klaus
        > --
        > People often find it easier to be a result of the past than a cause
        of
        > the future.
        > -
      Your message has been successfully submitted and would be delivered to recipients shortly.