Bug 231933 - bc hanging and leaving zombie of dc when being called by process with SIGCHLD blocked
Summary: bc hanging and leaving zombie of dc when being called by process with SIGCHLD...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-04 05:45 UTC by Vladimir Vinogradenko
Modified: 2018-10-04 05:45 UTC (History)
0 users

See Also:


Attachments
Patch that fixes described issue (396 bytes, patch)
2018-10-04 05:45 UTC, Vladimir Vinogradenko
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Vinogradenko 2018-10-04 05:45:14 UTC
Created attachment 197768 [details]
Patch that fixes described issue

In our system (http://www.freenas.org/) uwsgi application server calls a python program that calls a shell script that calls a shell script that calls bc and it hangs leaving us with hanging process tree like this:

```
3135   |-- /usr/local/bin/uwsgi <...long text cut>
4435   | `-- /usr/local/bin/uwsgi <...long text cut>
8952   |   |-- /bin/sh /usr/sbin/service smartd-daemon status
9087   |   | `-- /bin/sh /usr/sbin/service smartd-daemon status
9088   |   |   `-- /bin/sh /usr/sbin/service smartd-daemon status
9090   |   |     `-- /usr/bin/bc
9091   |   |       `-- <defunct>
```

This happens because bc relies on SIGCHLD to determine that dc has completed, wait for it and exit on it's own. SIGCHLD is blocked by uwsgi and this blocking is inherited by each it's subprocess. Our shell scripts are rather complicated and call a lot of other programs and bc was the only one that has this issue, so, despite no specification defines who should clear process signal mask, caller or callee, I think this should be fixed with simple patch attached.