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

4174Re: [soaplite] client daemon increasing memory

Expand Messages
  • Duncan Cameron
    Nov 10, 2004
      At 2004-11-10, 01:17:09 zperlcoder <zperlcoder@...> wrote:

      >I have a daemon monitoring a directory and sending files using
      >SOAP::Lite to a .NET SOAP service. Everything seemed ok until I
      >looked at the memory...my daemon kept on growing and I believe I
      >narrowed it down to the SOAP::Lite portion of the code (not claiming
      >to have found the culprit...). The following snippet reproduces the
      > my $soap;
      > unless( eval { $soap = SOAP::Lite
      > -> proxy("http://ipaddress/blabla.asmx")
      > -> uri("http://blabla/")
      > -> namespace("blabla")
      > -> on_action(sub{join '', @_});
      > }
      > ){
      > print "ERROR: $@\n";
      > }else{
      > my $response = $soap->Method() };
      > etc...
      > }
      > sleep(5);
      >If the client can't connect to the server (HTTP return code 5xx or
      >4xx) which is caught by the eval statement and continues to run in
      >its while loop, the memory size keeps on growing...is that the
      >expected behaviour? If it is, which changes do I need to make to
      >keep a constant memory footprint? (version .60a)
      >Thanks in advance for your help!
      Hi Alex

      I was puzzled as to why you had an eval {} around the creation of the
      SOAP::Lite object, then noticed that you have a namespace() call. This
      is incorrect, there is no such method for a S::L object, so it will be
      treated as a remote method to be called.

      To catch the errors the eval needs to be around the call to the remote

      use strict;
      use SOAP::Lite;

      my $soap;
      $soap = SOAP::Lite
      -> proxy("http://ipaddress/blabla.asmx")
      -> uri("http://blabla/")
      -> on_action(sub{join '', @_})
      eval {
      my $response = $soap->Method() ;
      # do something with the response
      print "ERROR: $@\n" if $@;

      Try this and see whether the memory usage improves.

    • Show all 5 messages in this topic