Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using strace fixes hung memory issue

I have a multithreaded process running on RHEL6.x (64bit).

I find that the process hangs and some threads (of the same process) crash most of the time when I try to bring up the process. Some threads wait for shared memory between the threads to get created (I can see that all of it does not get created).

But when I use strace , the process does not hang and it works just fine (all of the memory that is supposed to be created, gets created). Even interrupting strace after the memory gets created, keeps the process running fine for good.

I have read this:

strace fixes hung process

which did give me an idea. But I am still unclear on this as the version of RHEL that they have used is not mentioned.

Also, another point is that, changing the kernel to a fedora (compatible) kernel did not produce the issue.

So, I would just like to know how exactly does strace affect a process ? (or is it just the stack that moves back to the kernel as pointed out in the link) ?

like image 767
umayneverknow Avatar asked Jan 29 '14 14:01

umayneverknow


1 Answers

I can't yet comment, but I've seen similar things in past work. Since there is not really a definitive answer to be given, I'm going to go with this:

What are the odds that you're entering a deadlock between threads due to timing issues, which get 'resolved' by strace slowing down the program execution?

What happens if you debug through the process, instead of strace?

like image 171
roelofs Avatar answered Oct 20 '22 17:10

roelofs