Summary:ASTERISK-24739: [patch] - Out of files -- call fails -- numerous files with inodes from under /usr/share/zoneinfo, mostly posixrules
Reporter:Ed Hynan (Ed)Labels:
Date Opened:2015-01-30 11:37:01.000-0600Date Closed:2015-03-10 12:44:12
Versions:11.15.0 Frequency of
Environment:OpenBSD 5.5 -- any kqueue(2) system; possibly Linux inotify too (but uncertain).Attachments:( 0) 11.15.0-u.diff
( 1) 11.7.0-u.diff
( 2) svn-trunk-Jan-26-2015-u.diff
Description:This is a file descriptor leak.  Inodes tracked to TZ data files.

Had Asterisk 11.7.0 (OpenBSD 5.5 ports) running about three and a half weeks before call failed.

Triggered by any changes causing an event in the 'inotify' thread implemented in main/stdtime/localtime.c. This might not become apparent for most users, but my asterisk runs on a host using a DHCP client, the dhclient regularly rewrites /etc/resolv.conf, and this triggers a file event because /etc/localtime is watched, it is a symlink, and the kqueue(2) code actually watches the directory of a symlink.

I have a fix on my system: although the last change is only running a couple of days, I had been able to trigger the bug at will -- e.g. chmod a TZ data file being watched, or create a file under /etc, and then vmail to trigger the time formatting code -- with the fix I can't trigger the bug at all.

In the URL field of this form I put a http URL to a patch against 11.7.0 and
in "Reference Notes" that patch, and 11.15.0 and svn trunk of Jan 26 too.

-Ed Hynan
Comments:By: Rusty Newton (rnewton) 2015-02-03 18:02:40.220-0600

Thanks for the contribution Ed, however the Asterisk project cannot accept in-line or external patches which are not submitted under a CLA.

The patches must be attached to the issue under "More > Attach Files" and marked as a contribution. To do this, you must first sign a Contributor's License Agreement and wait for it to be accepted by legal.

Please review the Asterisk [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process] at the linked wiki page.

Thanks again!

By: Ed Hynan (Ed) 2015-02-04 04:21:33.947-0600

Contributor License process done. Waiting for ACK; will then attach patch per your system.

By: Ed Hynan (Ed) 2015-02-04 08:05:35.641-0600

Patch for 11.7.0

By: Ed Hynan (Ed) 2015-02-04 08:06:07.157-0600

Patch for 11.15.0

By: Ed Hynan (Ed) 2015-02-04 08:06:48.662-0600

Patch for svn trunk

By: Matt Jordan (mjordan) 2015-02-21 10:57:06.431-0600

Just as an FYI, after providing feedback, you have to hit the "Send Back" button - otherwise bug marshals may miss your replies :-)

Thanks for providing the patches - it looks like there's a reasonable amount going on in there; the next appropriate step would be to post this for peer review on Review Board. I'll comment here with links to help with that process.

Again, thanks for the contribution!

By: Matt Jordan (mjordan) 2015-02-21 10:57:27.169-0600

Thanks for the contribution! If you'd like your contribution to be included faster, you should submit your patch for code review by the Asterisk Developer Community. To do so, please follow the Code Review [1] instructions on the wiki. Be sure to:
* Verify that your patch conforms to the Coding Guidelines [2]
* Review the Code Review Checklist [3] for common items reviewers will look for
* If necessary, provide tests for the Asterisk Test Suite that verify the correctness of your patch [4]

When ready, submit your patch and any tests to Review Board [5] for code review.


[1] https://wiki.asterisk.org/wiki/display/AST/Code+Review
[2] https://wiki.asterisk.org/wiki/display/AST/Coding+Guidelines
[3] https://wiki.asterisk.org/wiki/display/AST/Code+Review+Checklist
[4] https://wiki.asterisk.org/wiki/display/AST/Asterisk+Test+Suite+Documentation
[5] https://wiki.asterisk.org/wiki/display/AST/Review+Board+Usage

By: Ed Hynan (Ed) 2015-02-25 10:40:22.201-0600

A review request has been submitted (4450).

By: Matt Jordan (mjordan) 2015-03-10 12:43:55.345-0500

Merged in 11+. Thanks for the contributions!