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

Getting a timeout when forking a process

Expand Messages
  • Judd Taylor
    I ve got a Soap::Lite client/server. The server is running as a CGI script on apache (over SSL). The just forwards commands to be processed, and returns the
    Message 1 of 1 , Feb 12, 2007
    • 0 Attachment
      I've got a Soap::Lite client/server. The server is running as a CGI script on apache (over SSL). The just forwards commands to be processed, and returns the results.

      The problem is that some commands generate a background process, and while the actual server-side function returns, the client is timing out. What is odd, is that I know the client lib function (process_command()) is returning 1. So the hang has to be happening somewhere in the SOAP::Lite code.

      Has anyone else had problems forking and returning from a CGI server??

      Thanks,
      Judd



      Here's the error:
      Uncaught exception from user code:
              500 EOF when chunk header expected at ../../utils/test_soap_client.pl line 29
      at /usr/lib/perl5/site_perl/5.8.5/SOAP/Lite.pm line 3240
              SOAP::Lite::__ANON__('SOAP::Lite=HASH(0x527a90)', '\x{a}syntax error at line 1, column 0, byte 0 at /usr/lib64/perl5...') called at /usr/lib/perl5/site_perl/5.8.5/SOAP/Lite.pm line 3412
              SOAP::Lite::call('SOAP::Lite=HASH(0x527a90)', 'process_command', 'Antenna("Pedestal_1")->Track("GPS BIIR-13")') called at /usr/lib/perl5/site_perl/5.8.5/SOAP/Lite.pm line 3377
              SOAP::Lite::__ANON__('SOAP::Lite=HASH(0x527a90)', 'Antenna("Pedestal_1")->Track("GPS BIIR-13")') called at ../../utils/test_soap_client.pl line 29



      Here are some code snippets:

      CGI Server:

      use strict;
      #use diagnostics;    # Remove from production code

      use SOAP::Transport::HTTP;

      SOAP::Transport::HTTP::CGI
          -> dispatch_to( $dispatch_dir  )
          -> handle ;


      Server lib:

      sub process_command
      {
          my $self = shift;
          my $line = shift;
         
          my $sub = _pkg_name( 'process_command' );
         
         
          get_logger( $sub )->info("SOAP lib processing command \'$line\'.");
          $SIG{CHLD} = 'IGNORE';
         
          no strict 'vars';
          my $res = eval( $line );
          use strict;
         
          # Handle a syntax error:
          if( $@ )
          {
              # Issue an Error code:
              Set_Error( COMMAND_SYNTAX_ERROR );
              my $resp = $fail_prefix . join(",", @{ Get_Error() });
              return $resp;
          }
         
          my $val = get_return_value( $res );
         
          get_logger( $sub )->info("Command returned: $val.");
         
          return $val;
      } # End of process_command()...

      Client:

      use strict;
      use diagnostics;      # Remove from production code
      use SOAP::Lite;

      my $url = "https://$user:$pass\@$hostname/cgi-bin/SARSAT_SOAP.pl";

      # Pass the command-line argument for interpretation:
      my $som = SOAP::Lite
          ->uri('SOAP/Command')
          ->proxy( $url )
          ->process_command( $ARGV[0] );

      # Test for an error:
      if( $som->fault() )
      {
          print "Fault occured\n\tfaultcode = \'"
              . $som->faultcode() . "\'\n\tfaultstring = \'"
              . $som->faultstring() . "\'\n";
          exit(1);
      }

      # Print the result:
      print "Result = '" . $som->result() . "'\n";

      exit(0);




      -- 
      ____________________________
      Judd Taylor
      Software Engineer
      
      Orbital Systems, Ltd.
      8304 Esters Blvd, Suite 870
      Irving, TX 75063-2209
      
      judd.t@...
      (469) 442-1767 x127
      
      
    Your message has been successfully submitted and would be delivered to recipients shortly.