LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris and OpenSolaris.
General Sun, SunOS and Sparc related questions also go here.

Notices

Reply
 
LinkBack Search this Thread
Old 11-22-2007, 04:54 AM   #1
dayalan_cse
Member
 
Registered: Oct 2006
Posts: 117

Rep: Reputation: 15
coredump in free on solaris


Hello,

I am using Solaris 9/sparc64, I ran my code on sparc, compiled using cc 5.2 update 1 version. it crashes when it tries to free() a string variable (pointer variable for a string) and to narrow down the issue i print the address and string before doing free(p), it has proper address and string it got displayed in the STDOUT but when it tries to free that pointer it crashes.

Please let me know your inputs to resolve this issue.

Thanks,
Dayalan
 
Old 11-22-2007, 05:51 AM   #2
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Puppy
Posts: 3,048

Rep: Reputation: 95
er, you've done something wrong.
it is not a valid address for free.
there is no other answer.

that's all we have to go on.
 
Old 11-22-2007, 09:03 AM   #3
dayalan_cse
Member
 
Registered: Oct 2006
Posts: 117

Original Poster
Rep: Reputation: 15
core dump on solaris

Quote:
Originally Posted by bigearsbilly View Post
er, you've done something wrong.
it is not a valid address for free.
there is no other answer.

that's all we have to go on.
Hi,

thanks for the inputs, intersting information is sometimes it crashes int the same machine and sometimes its not. here is the stack trace.

==================================================================

waitid (0, 2ee, ffbfc570, 103)
fc759460 _waitpid (2ee, ffbfc65c, 100, fffffff8, ffffffe0, ffbfc6cd) + 5c
fc7959bc system (ffbfc840, fe251bf0, fe7a6c4c, 2eb, fee9e400, fe7a61c8) + 240
fd923824 fatal_handler (fe251800, 0, ffbfcb00, fe7a6c00, fe251800, 1) + 70
fc79fb9c sigacthandler (b, 0, ffbfcb00, 10c488, 66aee8, fc419380) + 28
--- called from signal handler with signal 11 (SIGSEGV) ---
fc747620 realfree (66aef0, fc7c2994, fc7c2994, 16, 16, fc589778) + 74
fc747e60 _free_unlocked (313cb0, 74264, 20ee4, fc7bc000, 0, 0) + 98
fc747db8 free (313cb0, fc56b890, 6ef, 421ec, fc5350a4, 0) + 20

==================================================================

As you said its i am doing something mistake here, how to make sure that is the issue is from my function or is it from free() (libc) from sun?

Thanks
Dayalan
 
Old 11-22-2007, 09:20 AM   #4
crisostomo_enrico
Member
 
Registered: Dec 2005
Location: Madrid
Distribution: Solaris 10, Solaris Express Community Edition
Posts: 547

Rep: Reputation: 35
Well, without seeing any code... I'd naturally guess that something is wrong with the code rather than with a library. Bugs related with memory management may be subtle and your code may or may not crash immediately, that's not a proof.

Can you show us the code?
 
Old 11-22-2007, 09:35 AM   #5
dayalan_cse
Member
 
Registered: Oct 2006
Posts: 117

Original Poster
Rep: Reputation: 15
core dump on Solaris

Quote:
Originally Posted by crisostomo_enrico View Post
Well, without seeing any code... I'd naturally guess that something is wrong with the code rather than with a library. Bugs related with memory management may be subtle and your code may or may not crash immediately, that's not a proof.

Can you show us the code?
I knew there are some debuggers for especially for memories those are valgrind and mcheck available only on Linux boxes, But the problem i am facing here in Solaris.

Can anybody suggest are there any kind of tools are available for memory debugging on Solaris (like in Linux Boxes).

Please let me know.

Thanks,
Dayalan
 
Old 11-22-2007, 04:10 PM   #6
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Ubuntu, OEL
Posts: 9,165

Rep: Reputation: 243Reputation: 243Reputation: 243
Quote:
Originally Posted by dayalan_cse View Post
Can anybody suggest are there any kind of tools are available for memory debugging on Solaris (like in Linux Boxes).
Sun studio 12 dbx has an excellent memory debugger. It's called RTC (run time checking). http://docs.sun.com/app/docs/doc/819-5257/blahb?a=view
 
Old 11-22-2007, 11:34 PM   #7
dayalan_cse
Member
 
Registered: Oct 2006
Posts: 117

Original Poster
Rep: Reputation: 15
core dump on solaris

Quote:
Originally Posted by jlliagre View Post
Sun studio 12 dbx has an excellent memory debugger. It's called RTC (run time checking). http://docs.sun.com/app/docs/doc/819-5257/blahb?a=view
Hello,

Thank you for the inputs.

Another observation on this issue is, I see some times application not getting crash (it ran fine) but sometimes (not predictable) it crashes.

Any ideas why it is happening like this?

Thanks,
Dayalan
 
Old 11-23-2007, 01:39 AM   #8
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Ubuntu, OEL
Posts: 9,165

Rep: Reputation: 243Reputation: 243Reputation: 243
Quote:
Originally Posted by dayalan_cse View Post
Another observation on this issue is, I see some times application not getting crash (it ran fine) but sometimes (not predictable) it crashes.

Any ideas why it is happening like this?
Yes. Random crashes is a typical behavior observed with memory buggy applications.

Your code or one of the libraries you use are probably messing with parts of memory located slightly outside the allocated areas.
 
Old 11-23-2007, 05:17 AM   #9
dayalan_cse
Member
 
Registered: Oct 2006
Posts: 117

Original Poster
Rep: Reputation: 15
core dump on solaris

Quote:
Originally Posted by jlliagre View Post
Yes. Random crashes is a typical behavior observed with memory buggy applications.

Your code or one of the libraries you use are probably messing with parts of memory located slightly outside the allocated areas.
I am not understanding, Can you please elborate little bit, I would like ot understand the issue.
 
Old 11-23-2007, 06:25 AM   #10
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Ubuntu, OEL
Posts: 9,165

Rep: Reputation: 243Reputation: 243Reputation: 243
Please read the page I posted a link to. There are examples of memory programming mistakes.

eg:
Code:
char *a = (char *)malloc(1);
a[1] = ”\0’;
 
Old 11-23-2007, 10:33 PM   #11
dayalan_cse
Member
 
Registered: Oct 2006
Posts: 117

Original Poster
Rep: Reputation: 15
core dump on solaris

Quote:
Originally Posted by jlliagre View Post
Please read the page I posted a link to. There are examples of memory programming mistakes.

eg:
Code:
char *a = (char *)malloc(1);
a[1] = ”\0’;
dbx is not able to find out the memory bug so my application runs fine under dbx or gdb.

how to enable "memory debug all kind of check related with memory" under dbx?

Thanks,
Dayalan
 
Old 11-24-2007, 01:18 AM   #12
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Ubuntu, OEL
Posts: 9,165

Rep: Reputation: 243Reputation: 243Reputation: 243
Here is how to enable all of them:
Code:
$ dbx yourProgram
(dbx) check -all
(dbx) run
...
 
Old 11-24-2007, 05:43 AM   #13
dayalan_cse
Member
 
Registered: Oct 2006
Posts: 117

Original Poster
Rep: Reputation: 15
core dump on solaris

Quote:
Originally Posted by jlliagre View Post
Here is how to enable all of them:
Code:
$ dbx yourProgram
(dbx) check -all
(dbx) run
...
I used "check -all" under dbx but it is not useful because it is not able to find the issue but when i ran same application from shell it crashes.

please let me know your inputs.

Thanks,
Dayalan
 
Old 11-24-2007, 08:23 AM   #14
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Ubuntu, OEL
Posts: 9,165

Rep: Reputation: 243Reputation: 243Reputation: 243
Another way to track memory issues with Solaris is using libumem.

http://developers.sun.com/solaris/ar...m_library.html

http://blogs.sun.com/peteh/entry/hid...umem_firewalls
 
Old 11-25-2007, 04:27 AM   #15
dayalan_cse
Member
 
Registered: Oct 2006
Posts: 117

Original Poster
Rep: Reputation: 15
core dump on solaris

Quote:
Originally Posted by jlliagre View Post
Hi,

my observation is when i ran application directly from shell it crashes so i set LD_PRELOAD = libumem.so.1 and UMEM_DEBUG = default then i ran the application the ran fine.

I cant predict where the issue is? [ from kernel? or from application? ]

One more question, how to core files using gcore command, to run gcore it requires "pid" but when ran the application it ran fastly so i could not find "pid". please let me know.

thanks for your inputs.

Thanks,
Dayalan
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Generating coredump on remote machine vivekvw Programming 1 02-04-2006 03:02 PM
Memory fault(coredump) error Gigantor Programming 5 10-31-2005 03:11 AM
Solaris 10 for free ($0) jlliagre Solaris / OpenSolaris 2 11-20-2004 10:09 PM
solaris free? yenonn Solaris / OpenSolaris 28 04-08-2004 12:36 PM
How to get free x86 Solaris??? CONWON Solaris / OpenSolaris 2 09-01-2003 12:52 PM


All times are GMT -5. The time now is 08:04 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration