isync has asked for the wisdom of the Perl Monks concerning the following question:

One of my scripts, essentially an XMLRPC server based on Frontier::Client exits after many hours of flawless working with the strange error message "Killed" - without any further explanation.

Any hint where this error comes from?

It might be that an underlying XML::Parser error triggered it, but not sure. As the script is a server (which I haven't designed to output much), the output is not that cronological linked to the underlying processes...
  • Comment on Why does my script exit with "Killed" - that's all...

Replies are listed 'Best First'.
Re: Why does my script exit with "Killed" - that's all...
by jettero (Monsignor) on Jul 20, 2007 at 10:25 UTC

    ... it means that something killed it. I'm assuming a unixy platform here, which means there's no way to catch the SIGKILL, but you may find something in the /var/log files. That is, unless you generate an error somewhere like that in the program.

    -Paul

Re: Why does my script exit with "Killed" - that's all...
by Mutant (Priest) on Jul 20, 2007 at 10:35 UTC
    It's probably something in the OS doing it, not within your script. If you're running Linux with a 2.4 or higher kernel, it will often be configured to kill off processes automatically if they reach a certain level of CPU or memory usage. Another possibility is ulimit (altho I'm not sure if that kills processes or just limits them).
      I found it!!

      Something in the OS - that was also my first thought, as I did not write such a silly error msg into my script.

      I am running Debian/Linux (Ubuntu). And the hint to var log was right: I found in var/log/kern.log an entry which sais "Out of memory: Killed process 2832 (perl)", which is what triggered the event!

      What my server-script does: it consumes (and needs) quite an amount of memory (about 200MB of 1Gig system dram total). The log also tells some swapping happened before the event, I think that swap, plus system plus my script was just too much... Now, I will insert some tweaks to reduce ram usage, until the system receives more physical ram. Thanks again!
      (although I am not yet such an ace to know what oom and ulimit exactly is..;) )
        One thing you might want to try is restarting your server periodically (if that's practical). perl has a habit of accumulating memory over long periods of time. Restarting the process should reset all that.
        Out Of Memory and User||Usage (depending on which flavor) Limit :D

        Don Wilde
        "There's more than one level to any answer."
      In linux, the OOM killer kills. I suspect the ulimit memory killer does too... It probably changes from *nix to *nix though. I wonder if the oom killer is the ulimit killer. Huh.

      -Paul

Re: Why does my script exit with "Killed" - that's all...
by Anonymous Monk on Jul 20, 2007 at 11:43 UTC
    Is there a way to measure the size of my data structures while the script is running?
    If so, I could test my structures for size every few cycles and see if there is a memory leak I didn't thought of.
      I typically watch this by running top and keeping an eye on the VIRT (total memory usage) and/or RES (physical/non-swap memory usage) columns.