From 694008e9bb94895c276210832eb901cec4c6345d Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Mon, 12 Jan 2009 20:12:58 +0000 Subject: [PATCH] Fix a reported bug whereby keyboard entry to a remote proc was being lost after the first iteration. In other words, if an application has a proc reading stdin from the keyboard, and that proc is not co-located with mpirun, then the system would hang. The problem was eventually traced to two bugs in the code: 1. the orted wasn't resetting the write event flag, thus preventing itself from turning it on again. 2. the HNP needed to check if the stdin was attached to tty or not before adding the delay for fairness. If it is attached to a tty, there is no need for the delay. This prevents some strangely slow typing response. This patch needs to move to 1.3 This commit was SVN r20246. --- orte/mca/iof/hnp/iof_hnp_read.c | 11 ++++++++++- orte/mca/iof/orted/iof_orted.c | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/orte/mca/iof/hnp/iof_hnp_read.c b/orte/mca/iof/hnp/iof_hnp_read.c index f99d578dbd..df07deb8b0 100644 --- a/orte/mca/iof/hnp/iof_hnp_read.c +++ b/orte/mca/iof/hnp/iof_hnp_read.c @@ -47,6 +47,7 @@ static void restart_stdin(int fd, short event, void *cbdata) { if (NULL != mca_iof_hnp_component.stdinev) { + mca_iof_hnp_component.stdinev->active = true; opal_event_add(&(mca_iof_hnp_component.stdinev->ev), 0); } } @@ -179,7 +180,15 @@ void orte_iof_hnp_read_local_handler(int fd, short event, void *cbdata) /* this will also close our stdin file descriptor */ OBJ_RELEASE(mca_iof_hnp_component.stdinev); } else { - ORTE_TIMER_EVENT(0, 10000, restart_stdin); + /* if we are looking at a tty, then we just go ahead and restart the + * read event assuming we are not backgrounded + */ + if (orte_iof_hnp_stdin_check(fd)) { + restart_stdin(fd, 0, NULL); + } else { + /* delay for awhile and then restart */ + ORTE_TIMER_EVENT(0, 10000, restart_stdin); + } } /* nothing more to do */ OPAL_THREAD_UNLOCK(&mca_iof_hnp_component.lock); diff --git a/orte/mca/iof/orted/iof_orted.c b/orte/mca/iof/orted/iof_orted.c index 8aa82d139a..33d2ea6aac 100644 --- a/orte/mca/iof/orted/iof_orted.c +++ b/orte/mca/iof/orted/iof_orted.c @@ -249,6 +249,7 @@ static void stdin_write_handler(int fd, short event, void *cbdata) /* lock us up to protect global operations */ OPAL_THREAD_LOCK(&mca_iof_orted_component.lock); + wev->pending = false; while (NULL != (item = opal_list_remove_first(&wev->outputs))) { output = (orte_iof_write_output_t*)item;