Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Expect.pm causing Memory fault?

by vishi (Beadle)
on Aug 04, 2011 at 09:09 UTC ( [id://918473]=perlquestion: print w/replies, xml ) Need Help??

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

Hi Monks,

I am using the module Expect.pm to automate tasks by sending commands to a remote host. All these days, expect was behaving normally, but all of a sudden, my programs have started to throw a "Memory fault" error.

When I ran the code in debugging mode, I found out that as soon as I do a

my $sshAuth = Expect->spawn("ssh $User\@$source_DB");

The program terminates with a Memory fault. I am not sure what's causing the issue. How do I go about figuring out whether:

  • It's my Code that is causing the issue
  • It's Expect.pm
  • It's the machine on which I am running the code
  • It's got something to do with the Perl interpreter (gcc perhaps?)

Is there some way I can "trap" this to find the root cause?

Replies are listed 'Best First'.
Re: Expect.pm causing Memory fault?
by i5513 (Pilgrim) on Aug 04, 2011 at 14:26 UTC
    Hello

    See what "free" command says about free memory, and what "ulimit" command says about limits has your user

    But, wait! Which is the exact message which your application/perl give you ?

    Maybe it is not a limit / free memory available problem

    In your situation, I surely would test an "empty program" with only your sentence:

    #!/usr/bin/perl use strict; use Expect; my $user="user"; my $source_DB="source"; Expect->spawn("ssh $User\@$source_DB"); Expect->interact;

    And see if it is the root cause .. (I doubt it)

    Maybe google has more hints

    Regards,

      I did that .. and a regular Perl program runs fine. When I use the module, it goes crazy. Another development is that I cannot use the debugger now - when I run the program in the debugging mode, I do not get the debugger prompt. Instead, it hangs and I see that CPU utilization hits 100%. I have to forcibly stop and kill the process (Ctrl Z & kill -9 PID).

      What's surprising is that other programs that use the same module are running fine. I'm not sure what's so special about this piece of code that's making Perl angry that it throws a "Memory fault" at me.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://918473]
Approved by Perlbotics
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-03-29 15:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found