Index: /branches/eam_branches/ohana.20190329/src/opihi/lib.data/open_kapa.c
===================================================================
--- /branches/eam_branches/ohana.20190329/src/opihi/lib.data/open_kapa.c	(revision 40783)
+++ /branches/eam_branches/ohana.20190329/src/opihi/lib.data/open_kapa.c	(revision 40784)
@@ -266,4 +266,5 @@
 int close_kapa (char *name) {
 
+  struct timespec request, remain;
   int N;
 
@@ -274,4 +275,24 @@
   }
   DelKapaDevice (name);
+
+  // avoid blocking on waitpid, test every 1 msec, up to 500 msec
+  request.tv_sec = 0;
+  request.tv_nsec = 1000000;
+
+  // try to harvest the child PID
+  int waitstatus = 0;
+  int result = waitpid (-1, &waitstatus, WNOHANG);
+  for (int i = 0; (i < 500) && (result == 0); i++) {
+    nanosleep (&request, &remain);
+    result = waitpid (-1, &waitstatus, WNOHANG);
+  }
+
+  if ((result == -1) && (errno != ECHILD)) {
+    fprintf (stderr, "unexpected error from waitpid (%d): programming error\n", errno);
+  }
+  if (result == 0) {
+    fprintf (stderr, "child did not exit (close_kapa), timeout");
+  }
+
   return (TRUE);
 }
