[PATCH 0/1] Fix deadlock at calling fork() in console

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 0/1] Fix deadlock at calling fork() in console

Takashi Yano
In cygwin test release 3.1.0-0.1, calling fork on console ocasionally
falls into deadlock. The reason is not clear, however, this patch fixes
this problem anyway.

Takashi Yano (1):
  Cygwin: console: Fix deadlock at calling fork().

 winsup/cygwin/fhandler_console.cc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--
2.21.0

Reply | Threaded
Open this post in threaded view
|

[PATCH 1/1] Cygwin: console: Fix deadlock at calling fork().

Takashi Yano
- Calling fork() on console occasionally falls into deadlock. The reason
  is not clear, however, this patch fixes this problem anyway.
---
 winsup/cygwin/fhandler_console.cc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index 3d26a0b90..4afb7efb7 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -168,8 +168,12 @@ fhandler_console::set_unit ()
       if (created)
  con.owner = getpid ();
     }
-  if (!created && shared_console_info && kill (con.owner, 0) == -1)
-    con.owner = getpid ();
+  if (!created && shared_console_info)
+    {
+      pinfo p (con.owner);
+      if (!p)
+ con.owner = getpid ();
+    }
 
   dev ().parse (devset);
   if (devset != FH_ERROR)
--
2.21.0

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 0/1] Fix deadlock at calling fork() in console

Corinna Vinschen-2
In reply to this post by Takashi Yano
On Aug 12 22:46, Takashi Yano wrote:

> In cygwin test release 3.1.0-0.1, calling fork on console ocasionally
> falls into deadlock. The reason is not clear, however, this patch fixes
> this problem anyway.
>
> Takashi Yano (1):
>   Cygwin: console: Fix deadlock at calling fork().
>
>  winsup/cygwin/fhandler_console.cc | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> --
> 2.21.0
Pushed.


Thanks,
Corinna

--
Corinna Vinschen
Cygwin Maintainer

signature.asc (849 bytes) Download Attachment