Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

linux strace shows read(13, <unfinished ...> as last strace when program throws segmentation fault.

Posted on 2011-09-23
4
Medium Priority
?
2,192 Views
Last Modified: 2013-11-13
In Linux, I did  strace for my program (multi-thread processing) when I stop the process. the last strace statement is below. what does it mean "read(13, <unfinished ...>?
Does it mean the program try to read something from file descriptor 13, and not finish and then get segmentation fault?
or the program read something invalid?

write(5, "{NULL, 7, 1, SM_ProcMgmt.C, 74, "..., 87) = 87
write(12, "\0\0\0\0", 4)                = 4
read(13,  <unfinished ...>

I did a gdb for the core file, and see segmentation fault as below. I check the line 1513, is return(NULL) from a function which return void* ( void*SM_ProcMgmt::signalThread(void* arg)).
So return (null) should be valid. Any idea would be appreciated on how to further debug and what could be wrong?

# 0  0x00000000 in ?? ()
#1  0xf7df05df in SM_ProcMgmt::signalThread (arg=0xffc21f30) at SM_ProcMgmt.C:1513
#2  0x00c1f832 in start_thread () from /lib/libpthread.so.0
#3  0x00b89f6e in clone () from /lib/libc.so.6



+++ killed by SIGSEGV (core dumped) +++
0
Comment
Question by:ndoung
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 35

Accepted Solution

by:
Duncan Roe earned 2000 total points
ID: 36594174
Yes there is an unfinished read() on file unit 13. However it is not even likely that this is the cause of the SIGSEGV (unless, for instance, the buffer address is out of range).
You need to look back up your strace output until you find what is open on file unit 13. If, say, it's a pipe (as distinct from a regular file) then incomplete read is perfectly normal until something writes to the other end of the pipe.
From the stack trace it more looks like clone() has been given a bad argument. But the clone() call is not in the strace output - did you use strace -f? You need to do that with multithreaded programs to see threads other than the first.
If you gdb the program, you can examine variables at the time of the SIGSEGV
0
 

Author Comment

by:ndoung
ID: 37230297
I've requested that this question be deleted for the following reason:

I no longer need to resolve the problem. So I do not need to pursuit.
0
 
LVL 35

Expert Comment

by:Duncan Roe
ID: 37230298
Just because ndoung no longer wishes to pursue this problem is no reason to delete valid answers andrefund his points. I think my initial answer was valid as far as it went - I expected the asker to pursue it further but he has chosen not to
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is about my first experience with programming Arduino.
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
Six Sigma Control Plans
Introduction to Processes

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question