> You are right. I dont need to restore the signal handler - one system call 
> less in my signal handler.
> I now saved a snapshot of the unfinished futex call. So I can experiment as 
> often as I want.
> Poking a 1 does not work. But Poking a 0 works perfektly fine.

Thank you for this information.


> And youre also right : I cannot use strace when the process is alredy 
> attached to my ptrace stuff. 
> So I will implement some PTRACE_SYSCALL steps myself to see the process 
> continuing after poking a 0.

Yes that is the best way; big work too, cheers.


> 
> Do you think, that errno could be the problem as well? Maybe a system call is 
> assinging a value to errno. Then the signal arrives and the handler tries to 
> access errno, too, which is blocked now? 


When we see that a syscall may be automatically restarted using the
SA_RESTART flag in the struct sigaction (you may have to set this flag
too if you plan to use sigaction(2) instead of signal(2)), then it may
be safe to interrupt a syscall and the errno will be restored safely by
the kernel when restarting the syscall.
So, I do not believe it could be the problem for the kernel part.
Il you choose not to use the SA_RESTART, your interrupted syscall may
return -1 and have an EINTR errno. This could cause trouble in the user
land depending on the code being executed.
As I am no more accurate with this and the kernel stuff, you may
consider my answer with lot of prudence.


> If really the debug() call is the reason, I wonder why this problem does not 
> happen more often. I am debugging a lot in my code. And besides the debug 
> calls like every 2nd or 3rd code line ends up as a system call. If 
> interrupting a system call and executing another system call in the handler 
> should cause the problem, I feel like this kind of deadlock should happen 
> more often...

I am not surprised by the non systematic circumstance because the debug() code 
may not be in totality re-entrant critical
and you need to have your synchrone part of your program running debug() too to 
be in a re-entrant trouble.
Just suppress the debug() call and test, you will have your answer.

-- 
Futex hang when exiting using the window close button
https://bugs.launchpad.net/bugs/57731
You received this bug notification because you are a member of Ubuntu
Desktop Bugs, which is a bug assignee.

-- 
desktop-bugs mailing list
desktop-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/desktop-bugs

Reply via email to