Fix for standard output / standard error truncation issue when in a shell
pipeline. See lengthy comment in iof_base_endpoint.c for the details, but the short version is that we shouldn't set O_NONBLOCK on standard I/O file descriptors, so we no longer do. Closes ticket:9 This commit was SVN r9966.
Этот коммит содержится в:
родитель
800ba39152
Коммит
7000cecf78
3
NEWS
3
NEWS
@ -60,6 +60,9 @@ version 1.0.
|
||||
1.0.3
|
||||
-----
|
||||
|
||||
- Fixed situation where mpirun could set a shell pipeline's stdout
|
||||
to non-blocking, causing the shell pipeline to prematurely fail.
|
||||
Thanks to Darrell Kresge for figuring out what was happening.
|
||||
- Fixed problems with leave_pinned that could cause Badness with the
|
||||
mvapi BTL.
|
||||
- Fixed problems with MPI_FILE_OPEN and non-blocking MPI-2 IO access.
|
||||
|
@ -306,7 +306,24 @@ int orte_iof_base_endpoint_create(
|
||||
endpoint->ep_tag = tag;
|
||||
endpoint->ep_fd = fd;
|
||||
|
||||
/* set to non-blocking */
|
||||
/* If it looks like we're on the mpirun side of a standard IO
|
||||
stream (like we're a SOURCE and tag is STDIN and we're mucking
|
||||
with fd 0), we don't want to set nonblocking. If we do so, we
|
||||
set the file descriptor to non-blocking for everyone that has
|
||||
that file descriptor, which includes everyone else in our shell
|
||||
pipeline chain. (See
|
||||
http://lists.freebsd.org/pipermail/freebsd-hackers/2005-January/009742.html).
|
||||
This causes things like "mpirun -np 1 big_app | cat" to lose
|
||||
output, because cat's stdout is then ALSO non-blocking and cat
|
||||
isn't built to deal with that case (same with almost all other
|
||||
unix text utils).
|
||||
|
||||
Otherwise, we're probably on the non-mpirun end of things, and
|
||||
should be non-blocking.
|
||||
*/
|
||||
if ( ! ((ORTE_IOF_SOURCE == mode && ORTE_IOF_STDIN == tag && 0 == fd) ||
|
||||
(ORTE_IOF_SINK == mode && ORTE_IOF_STDOUT == tag && 1 == fd) ||
|
||||
(ORTE_IOF_SINK == mode && ORTE_IOF_STDERR == tag && 2 == fd))) {
|
||||
if((flags = fcntl(fd, F_GETFL, 0)) < 0) {
|
||||
opal_output(0, "[%s:%d]: fcntl(F_GETFL) failed with errno=%d\n",
|
||||
__FILE__, __LINE__, errno);
|
||||
@ -314,6 +331,7 @@ int orte_iof_base_endpoint_create(
|
||||
flags |= O_NONBLOCK;
|
||||
fcntl(fd, F_SETFL, flags);
|
||||
}
|
||||
}
|
||||
|
||||
/* setup event handler */
|
||||
switch(mode) {
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user