问题
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) ?
回答1:
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?
来源:https://stackoverflow.com/questions/21433864/using-strace-fixes-hung-memory-issue