Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Error : Segmentation fault

by rose (Beadle)
on Jun 01, 2007 at 10:26 UTC ( #618685=perlquestion: print w/ replies, xml ) Need Help??
rose has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

Whil I am running my script its sayind an error message

Segmentation fault

Actually the code is connecting the oracle database by using user name and password.

Can you please guide me

Thanks
Rose

Comment on Error : Segmentation fault
Download Code
Re: Error : Segmentation fault
by bart (Canon) on Jun 01, 2007 at 10:36 UTC
    A "segmentation fault" is the Unixy term for a crash: some part of the progam or module that is written in compiled C, does something it should never do and the program is kicked out by the OS.

    Can you investigate it a little more, and see where it crashes? By what you said, probably in a DBI->connect statement? In that case, you may be suffering of a badly installed DBD::Oracle module – or DBI, if it crashes on other types of databases too.

      Additionally, please note that these types of crashes are notoriously difficult to track down. Perl doesn't exactly plan ahead for buffer overflows in XS modules — not that it could. I suspect that rather than figure out precisely what function is failing, it might be better to just try to reinstall DBD::Oracle and DBI and see if it quits crashing.

      -Paul

Re: Error : Segmentation fault
by sen (Hermit) on Jun 01, 2007 at 11:10 UTC

    Please check this,

    1. If the input file is created by just copying the text from windows machine & paste it in the unix system, it throws segmentation error

    2. If you fetch the data after finished the database handler(dbh->finish()), it also throws segmentation error.

      re 1) that's like saying if you drive over 70 mph. you will have a fatal accident 100% of the time instead of saying it "might" happen - moreover I ran into some code on Sun Solaris hacked in by a predecessor with all those nasty ^Ms on the end that only DOS/Windows knows how - it's been working in production for years!

      __________________________________________________________________________________

      ^M Free your mind!

Re: Error : Segmentation fault
by sanPerl (Friar) on Jun 01, 2007 at 12:17 UTC
    Since Segmentation fault is a runtime exception thrown by Unix OS. You can put the scipt in debug mode or you can use print statements like "I am here" after every line of code to detect which line is spoiling the show. Then you can start debuging once you get the said line.
Re: Error : Segmentation fault
by marto (Chancellor) on Jun 01, 2007 at 12:38 UTC
    In addition to what the other monks have already advised try checking your oracle logs to see if your script is getting as far as connecting to the database.

    Hope this helps

    Martin
Re: Error : Segmentation fault
by Moron (Curate) on Jun 01, 2007 at 13:34 UTC
    A segment is a contiguous piece of memory allocated to a program at runtime. A program generally has more than one segment allocated to it, usually at least a read-only one for code and a read-writeable one for data.

    A segmentation fault occurs when a program attempts either to write to a read-only segment or to read or write from/to a segment that doesn;t belong to it. Unless you're a hacker of legendary proportions, who would therefore know exactly what caused it already, it is inconceivable that you could have induced perl to seg fault. Oracle wouldn't segfault on an invalid login (or at least, it's been a lo-ong ti-ime since Oracle was that flaky {strokes beard} ;))

    After a segmentation fault there will be a file left over called "core" (the core dump of the actually crashed program, which I expect not to be perl :)). A quick and dirty way to get clues as to its cause is to look at:

    strings core | more
    This will at least confirm what really crashed and therefore which vendor to ask for support.
    __________________________________________________________________________________

    ^M Free your mind!

      ++. You could also try doing a backtrace but that would depend on perl and the oracle libs being compiled correctly.

      In this case, although specifics aren't given, I would suspect a faulty install of either the oracle client libs or the oracle perl modules - possibly a quick copy from an incompatible OS?

      -derby
Re: Error : Segmentation fault
by Random_Walk (Parson) on Jun 01, 2007 at 14:49 UTC

    Hi rose

    I have got seg faults before from having (or at least trying too have) way too much data in memory at one time. Are you perhaps getting some very big large results set back from your Oracle DB and then stuffing it all into some data structure ? If you are not already You may be better getting and processing your results one row at a time.

    Cheers,
    R.

    Pereant, qui ante nos nostra dixerunt!
Re: Error : Segmentation fault
by carmen (Initiate) on Jun 01, 2007 at 18:33 UTC
    Any chance of getting a piece of code to look at? Unluckily I've gotten segmentation faults in all languages for all sorts of reasons (from sheer dumbness on my part to something complex). Also (don't remember if someone has said this) but check to make sure that the oracle connection is being made ... maybe there's a problem with connecting to the server. Good luck -- Carmen

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://618685]
Approved by bart
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2014-09-16 01:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (155 votes), past polls