so-called pipe files (sh-np-*) do not get deleted when processes close.
From:
Michael Felt
Subject:
so-called pipe files (sh-np-*) do not get deleted when processes close.
Date:
Thu, 11 Mar 2021 17:28:07 +0100
User-agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1
Hi,
Issue: AdoptOpenJDK build process makes bash calls in a particular way.
An abbreviated (shorter pathnames) example is:
```
bash-5.0$ /usr/bin/printf "Building targets 'product-images
legacy-jre-image test-image' in configuration
'aix-ppc64-normal-server-release'\n" > >(/usr/bin/tee -a
/home/aixtools/build.log) 2> >(/usr/bin/tee -a /home/aixtools/build.log >&2)
Building targets 'product-images legacy-jre-image test-image' in
configuration 'aix-ppc64-normal-server-release'
```
back to ksh:
```
$ cat ~/build.log
Building targets 'product-images legacy-jre-image test-image' in
configuration 'aix-ppc64-normal-server-release'
```
I added some debug statements to try and catch what is not happening. It
seems that the fifo_list[i].proc value is never being set to (pid_t)-1
so any call to `unlink_fifo()` or `unlink_fifo_list()` does not unlink
the special file created.
I have forced some debug info:
a) unset USE_MKTEMP
b) added the PID of the process creating the special file
c) additional debug info using fprintf(FILE, ...)
fprintf(unlink_lst,"%d:%s:%d:%16s:%2d:%12d:%s\n", getpid(),
__FILE__, __LINE__, "unlink_fifo_list", i, fifo_list[i].proc,
fifo_list[i].file);
That gives me the following information from the command above:
25231596:../src/bash-5.0.18/execute_cmd.c:752:execute_command_internal:/usr/bin/printf
"Building targets 'product-images legacy-jre-image test-image' in
configuration 'aix-ppc64-normal-server-release'\n" > >(/usr/bin/tee -a
/home/aixtools/build.log) 2> >(/usr/bin/tee -a /home/aixtools/build.log >&2)
21233868:../src/bash-5.0.18/subst.c:5372: add_fifo_list: 0:
0:/tmp//sh-np-21233868-1115804781
27918500:../src/bash-5.0.18/execute_cmd.c:752:execute_command_internal:/usr/bin/tee
-a /home/aixtools/build.log
21233868:../src/bash-5.0.18/subst.c:5372: add_fifo_list: 1:
0:/tmp//sh-np-21233868-3761770506
And this is remaining:
$ ls -l /tmp/sh-np* | grep 21233868
prw------- 1 aixtools staff 0 Mar 11 08:07
/tmp/sh-np-21233868-1115804781
prw------- 1 aixtools staff 0 Mar 11 08:07
/tmp/sh-np-21233868-3761770506
Getting back to AdoptOpenJDK - a build process has roughly 3750 of these
commands - leaving 7500 files behind in /tmp. On a busy day this can
lead to over 100k empty files in /tmp.