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

2251SOAP::Lite interaction w/ Exception::Class results in Perl seg fault

Expand Messages
  • Peter Chen <petechen@dragon.rutgers.edu>
    Jan 8, 2003
    • 0 Attachment
      FYI - there seems to be a conflict/caveat using SOAP::Lite w/
      Exception::Class that is severe enough to cause Perl to segfault.

      I encountered an odd case where a daemon using
      SOAP::Transport::HTTP::Daemon some how caused perl (Mandrake 8.1,
      Linux 2.4.16 kernel, perl-5.601-6mdk, SOAP::Lite 0.55,
      Exception::Class 1.00) to segfault.

      Using the perl debugger, I was able to trace the problem to gen_id()
      at line 803 in SOAP/Lite.pm:

      sub gen_id { sprintf "%U", $_[1] }

      It seems that there is some black magic here, where the address of a
      reference is returned. And this function is not intended to handle a
      scalar.

      The problem is that when one of the dispatched functions uses
      Exception::Class and throws such an exception. It dies with an
      object, and not a scalar. This means when the SOAP fault is
      serialized, gen_id() is called. However, the stringify operator is
      overloaded for Exception::Class, so printing such an exception object
      will return $exception->message instead. This in turn causes problems
      with gen_id(), where sprintf("%U", $exception) becomes sprintf("%U",
      $exception->message).

      I circumvented the problem by catching the exception within the
      function, then "die $exception->message" instead. However, this seems
      somewhat kludgey. Perhaps there is a cleaner fix in SOAP::Lite, so it
      can handle modules that use Exception::Class.

      Incidentally, a quick search in the archive shows that this is not the
      first time problems of this sort are reported. In last September,
      there was a mention about Exception::Class as well.

      http://groups.yahoo.com/group/soaplite/message/1817

      Pete
    • Show all 4 messages in this topic