Re: Unsightly errors due to race on closing stdin when handling signals in s6-log

2021-12-23 Thread Earl Chew via skaware

Laurent,


I don't like opening anything (even /dev/null) on an exit path


Though I was looking to keep the scope of my efforts limited, I think 
this would be preferred if you an achieve it.


Earl


On , Laurent Bercot wrote:
IIRC the use case involves signal handling, which causes 
prepare_to_exit() to be called in handle_signals(). Once the signal 
handler returns, stdin is closed. The mainline continues to refer to 
the now closed file descriptor, and emits errors as consequence. The 
process terminates, but the path to exit is unsightly.


 Ah, good catch. Thanks for the report and the patch!
 I don't like opening anything (even /dev/null) on an exit path, so
I'll try to fix the problem in another way (tracking use of fd 0 in
the mainline) over the next few days. If it proves too difficult, I'll
commit something similar to your patch.

--
 Laurent



Re: Unsightly errors due to race on closing stdin when handling signals in s6-log

2021-12-23 Thread Laurent Bercot

IIRC the use case involves signal handling, which causes prepare_to_exit() to 
be called in handle_signals(). Once the signal handler returns, stdin is 
closed. The mainline continues to refer to the now closed file descriptor, and 
emits errors as consequence. The process terminates, but the path to exit is 
unsightly.


 Ah, good catch. Thanks for the report and the patch!
 I don't like opening anything (even /dev/null) on an exit path, so
I'll try to fix the problem in another way (tracking use of fd 0 in
the mainline) over the next few days. If it proves too difficult, I'll
commit something similar to your patch.

--
 Laurent