Bug 1592376
| Summary: | Restraint suppresses broken pipe handling in shell pipelines invoked by a task | ||
|---|---|---|---|
| Product: | [Retired] Restraint | Reporter: | Ondrej Mejzlik <omejzlik> |
| Component: | general | Assignee: | Matt Tyson 🤬 <mtyson> |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Jacob McKenzie <jmckenzi> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 0.1.32 | CC: | asavkov, bpeck, dcallagh, jhladky, mtyson, rjoost, zlang |
| Target Milestone: | 0.1.36 | Keywords: | Triaged |
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2018-09-17 05:50:11 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Comment 1
Dan Callaghan
2018-06-19 03:35:25 UTC
This is caused by glib2. When a GSocket is created, the SIGPIPE signal is ignored. https://developer.gnome.org/gio/stable/GSocket.html > Note that creating a GSocket causes the signal SIGPIPE to be ignored for the remainder of the program The fix here is to set SIGPIPE back to its default action in the forked child process. Nice catch. I'm surprised that the GLib stuff we are using to execute subprocesses is not smart enough to reset signal handlers for us, since it is GLib messing with the signal handlers in the first place. Are there any other process characteristics we need to worry about resetting in the subprocesses? Do we have CLOEXEC set on all file descriptors? Is there anything else inherited that might be a problem? (I didn't even know that the signal handler table is inherited so I would never have even guessed this.) (In reply to Dan Callaghan from comment #3) > Nice catch. I'm surprised that the GLib stuff we are using to execute > subprocesses is not smart enough to reset signal handlers for us. Restraint doesn't actually use any of glib's process spawning routines. Restraint does an old fashioned fork() and exec(). > Are there any other process characteristics we need to worry about resetting > in the subprocesses? It looks like there is. Restraint sets signal handlers for SIGINT and SIGTERM. We should set those back to default. > Do we have CLOEXEC set on all file descriptors? Is there anything else inherited that might be a problem? CLOEXEC is set in one place it seems. I'd have to check in a little more detail to make sure that covers everything. (In reply to Matt Tyson from comment #4) > (In reply to Dan Callaghan from comment #3) > > Nice catch. I'm surprised that the GLib stuff we are using to execute > > subprocesses is not smart enough to reset signal handlers for us. > > Restraint doesn't actually use any of glib's process spawning routines. > Restraint does an old fashioned fork() and exec(). Should we perhaps? (In reply to Roman Joost from comment #5) > > Restraint doesn't actually use any of glib's process spawning routines. > > Restraint does an old fashioned fork() and exec(). > > Should we perhaps? https://developer.gnome.org/glib/stable/glib-Spawning-Processes.html glib's process spawning routines seem to have some limitations on what can be done in the child process config routine. We do some setup between the fork and exec. I'd have to check to see if we can use the glib routines or not, and if they even solve the problem of SIGPIPE being changed. Ah right, I think I remember now... we needed some custom code to handle setting up a pty for the task subprocess. I've added a routine that sets every signal handler back to its default value. This should prevent tests exhibiting strange behaviour if they trip signals that restraint has handlers for. This patch is available in builds > restraint-0.1.35-1.git.4.*, which are now available in beaker-devel. This patch seems to have fixed the aforementioned bug. I re-ran the task mentioned in the #c1 and it worked as expected. Test can be seen here: https://beaker-devel.app.eng.bos.redhat.com/jobs/14740 The test was also performed with an older version of restraint, and it failed as it did for omejzlik. Test can be seen here: https://beaker-devel.app.eng.bos.redhat.com/jobs/14729 (In reply to Jacob McKenzie from comment #10) > This patch seems to have fixed the aforementioned bug. The bug seems to be fixed by mtyson's patch... I have run into the same issue with this command: (while :; do echo ""; done ) | sensors-detect Further debugging has shown that Bash with restraint harness ignores SIGPIPE signal: trap -- '' SIGPIPE I have tried to work around the issue by canceling the trap trap - SIGPIPE; (while :; do echo ""; done ) | sensors-detect but it didn't help. I will try https://beaker-devel.app.eng.bos.redhat.com to verify the fix. Thanks Jirka The fix works for me:-) https://beaker-devel.app.eng.bos.redhat.com/recipes/25253#task163205 *** Bug 1623391 has been marked as a duplicate of this bug. *** Restraint 0.1.36 was released on 24 August. |