bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* pipe-filter-gi: Fix test failure on AIX 7.2
@ 2021-01-06  6:30 Bruno Haible
  0 siblings, 0 replies; only message in thread
From: Bruno Haible @ 2021-01-06  6:30 UTC (permalink / raw)
  To: bug-gnulib

On AIX 7.2, I see a test failure:

FAIL: test-pipe-filter-gi1.sh
=============================

test-pipe-filter-gi1: write to tr subprocess failed: Resource temporarily unavailable
FAIL test-pipe-filter-gi1.sh (exit status: 1)

What happens is: While writing to a pipe, through a file descriptor in
non-blocking mode, after select() reported that the file descriptor is
writeable, write() of a block of 29 KB of data fails with errno = EAGAIN.
This is persistent; it does not go away by retrying even hundreds of times.

Other OSes would have done a partial write and returned a positive return
code. (Especially as 1. the file descriptor refers to a pipe, not a regular
file, and 2. it is in non-blocking mode.) AIX, however, forces the program
to do the throttling by itself: Limiting the write to 4 KB works around the
issue.


2021-01-05  Bruno Haible  <bruno@clisp.org>

	pipe-filter-gi: Fix test failure on AIX 7.2.
	* lib/pipe-filter-aux.h (SSIZE_MAX) [AIX]: Set to 4096.

diff --git a/lib/pipe-filter-aux.h b/lib/pipe-filter-aux.h
index 294a27e..2977260 100644
--- a/lib/pipe-filter-aux.h
+++ b/lib/pipe-filter-aux.h
@@ -26,6 +26,15 @@ _GL_INLINE_HEADER_BEGIN
 #ifndef SSIZE_MAX
 # define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
 #endif
+#ifdef _AIX
+/* On AIX, despite having select() and despite having put the file descriptor
+   in non-blocking mode, it can happen that select() reports that fd[1] is
+   writable but writing a large amount of data to fd[1] then fails with errno
+   EAGAIN.  Seen with test-pipe-filter-gi1 on AIX 7.2, with data sizes of
+   29 KB.  So, limit the size of data passed to the write() call to 4 KB.  */
+# undef SSIZE_MAX
+# define SSIZE_MAX 4096
+#endif
 
 /* We use a child process, and communicate through a bidirectional pipe.
    To avoid deadlocks, let the child process decide when it wants to read



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-06  6:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-06  6:30 pipe-filter-gi: Fix test failure on AIX 7.2 Bruno Haible

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).