Hallo,
I don't understand why pthread_kill_other_threads ist called when a programm creates a new process. With the pthread_kill_other_threads call, the starting process dies. This is a +relay,+server,+... log:
trace:dosfs:DOSFS_GetFullName returning /home/dosd/cae/ql82/scs/TKWDOG.EXE = D:\CAE\QL82\SCS\TKWDOG.EXE 08068938: new_process( inherit_all=0, create_flags=67108864, start_flags=257, exe_file=200, hstdin=4, hstdout=8, hstderr=12, cmd_show=1, filename="D:\cae\ql82\scs\TKWDOG.EXE" ) 08068938: new_process() = 0 { info=204 } fixme:pthread_kill_other_threads_np 08068938: select( flags=12, cookie=0x405c5778, sec=1001624181, usec=913175, handles={204} ) 08068938: select() = PENDING 00000000: *fd* 0 -> 46 08625a70: *fd* 6 <- 46 08625a70: *fd* 8 <- 47 08625a70: init_thread( unix_pid=2070, teb=0x40127ce0, entry=(nil), reply_fd=6, wait_fd=8 ) 08625a70: init_thread() = 0 { pid=0x86259a0, tid=0x8625a70, boot=0, version=53 }
This is an strace of that part: 1898 close(28) = 0 1898 chdir("/home/dosd/cae/ql82/scs") = 0 1898 write(2, "fixme:pthread_kill_other_threads"..., 36) = 36 1898 execve("/usr/local/bin/wine", ["/usr/local/bin/wine", "--", "tkwdog.exe"], [/* 57 vars */] <unfinished ...>
and I think this relates to scheduler/process.c:fork_and_exec if (newdir) chdir(newdir);
if (argv && envp) { if (!filename) { argv[1] = "--"; exec_wine_binary( argv, envp ); } else execve( filename, argv, envp ); }
What can happen between chdir() and execve() to trigger the pthread_kill_other_threads() call?
Bye
Uwe Bonnes bon@elektron.ikp.physik.tu-darmstadt.de
Free Software: If you contribute nothing, expect nothing --
On Thu, 27 Sep 2001, Uwe Bonnes wrote:
What can happen between chdir() and execve() to trigger the pthread_kill_other_threads() call?
Well, not much... glibc's execve() implementation calls pthread_kill_other_threads_np() itself to prepare the threading system for an exec. This is a feature, not a bug.
Uwe Bonnes wrote:
I don't understand why pthread_kill_other_threads ist called when a programm creates a new process. With the pthread_kill_other_threads call, the starting process dies. ... What can happen between chdir() and execve() to trigger the pthread_kill_other_threads() call?
This is per the Posix standard; http://www.opengroup.org/onlinepubs/007908799/xsh/exec.html says: "A call to any exec function from a process with more than one thread results in all threads being terminated and the new executable image being loaded and executed."
Maybe this is hurting you because LinuxThreads implements fork() in a nonstandard way, i.e. maybe it only forks the current thread rather than the whole process?
In any case, what you're trying to do is so common and important that maybe it's a glibc bug. Which glibc and kernel are you using?
- Dan
"Dan" == Dan Kegel dank@kegel.com writes:
Dan> Uwe Bonnes wrote: >> I don't understand why pthread_kill_other_threads ist called when a >> programm creates a new process. With the pthread_kill_other_threads >> call, the starting process dies. ... What can happen between chdir() >> and execve() to trigger the pthread_kill_other_threads() call?
Dan> This is per the Posix standard; Dan> http://www.opengroup.org/onlinepubs/007908799/xsh/exec.html says: Dan> "A call to any exec function from a process with more than one Dan> thread results in all threads being terminated and the new Dan> executable image being loaded and executed."
Dan> Maybe this is hurting you because LinuxThreads implements fork() in Dan> a nonstandard way, i.e. maybe it only forks the current thread Dan> rather than the whole process?
Dan> In any case, what you're trying to do is so common and important Dan> that maybe it's a glibc bug. Which glibc and kernel are you using?
I am trying to run a windows program combo ( schem.exe from the quicklogic qworks 9.0 beta). The programm starts, tells about the demo license and then starts a "background" process called tkwdog.exe, as I understand it. After the background programm pops up its desktop window, the schem.exe window isn't refreshed any more. I thought this would relate to pthread_kill_other_threads_np, but obviously I am wrong. schem.exe hangs in a WaitForSingleObject call:
Here again an excerpt from the relay log, hopefully more helpfull: 1844 08068938:Call kernel32.CreateEventA(00000000,00000001,00000000,100192a0 "TKMESG response trigger") ret=100168c1 1845 08068938:Ret kernel32.CreateEventA() retval=0000007c ret=100168c1 ... 51123 08068938:Call kernel32.ResetEvent(0000007c) ret=100169fd 51124 08068938:Ret kernel32.ResetEvent() retval=00000001 ret=100169fd 51125 08068938:Call kernel32.CreateProcessA(00000000,10019364 "tkwdog.exe",00000000,00000000,00000000,04000000,00000000,00000000,405f6b7c,405f6b6c) ret=10016a23 51126 fixme:module:CreateProcessA (D:\cae\pasic90\scs\TKWDOG.EXE,...): CREATE_DEFAULT_ERROR_MODE ignored 51127 fixme:pthread_kill_other_threads_np 51128 FIXME:pthread_rwlock_rdlock 51129 FIXME:pthread_rwlock_unlock 51130 FIXME:pthread_rwlock_rdlock 51131 FIXME:pthread_rwlock_unlock 51132 08068938:Ret kernel32.CreateProcessA() retval=00000001 ret=10016a23 51133 08068938:Call kernel32.WaitForSingleObject(0000007c,ffffffff) ret=10016a4d 51134 096d4e18:Ret x11drv.MsgWaitForMultipleObjectsEx() retval=00000001 ret=406c7efd 51135 096d4e18:Call x11drv.MsgWaitForMultipleObjectsEx(00000000,00000000,00000000,00000000,00000000) ret=406c7b80 51136 096d4e18:Ret x11drv.MsgWaitForMultipleObjectsEx() retval=00000102 ret=406c7b80 51137 096d4e18:Call window proc 0x40a134e0 (hwnd=00010020,msg=WM_NCHITTEST,wp=00000000,lp=010b01ac) 51138 096d4e18:Ret window proc 0x40a134e0 (hwnd=00010020,msg=WM_NCHITTEST,wp=00000000,lp=010b01ac) retval=00000001 51139 096d4e18:Call window proc 0x40a134e0 (hwnd=00010020,msg=WM_SETCURSOR,wp=00010020,lp=02000001) 51140 096d4e18:Ret window proc 0x40a134e0 (hwnd=00010020,msg=WM_SETCURSOR,wp=00010020,lp=02000001) retval=00000276 51141 096d4e18:Call window proc 0x40a134e0 (hwnd=00010020,msg=WM_MOUSEMOVE,wp=00000000,lp=010b01ac) 51142 096d4e18:Ret window proc 0x40a134e0 (hwnd=00010020,msg=WM_MOUSEMOVE,wp=00000000,lp=010b01ac) retval=00000000 51143 096d4e18:Call x11drv.MsgWaitForMultipleObjectsEx(00000000,00000000,00000000,00000000,00000000) ret=406c7b80 51144 096d4e18:Ret x11drv.MsgWaitForMultipleObjectsEx() retval=00000102 ret=406c7b80 51145 096d4e18:Call x11drv.MsgWaitForMultipleObjectsEx(00000001,403faec4,ffffffff,00000000,00000000) ret=406c7efd
There is no more message from process 08068938 until I abort the program with ^C on the console.
Bye