Bug 768804 - NTP ntpq re-reads /etc/services many times
Summary: NTP ntpq re-reads /etc/services many times
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: ntp
Version: 19
Hardware: i686
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Lichvar
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-12-19 02:43 UTC by Doug Mitchell
Modified: 2013-04-20 20:19 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-04-20 20:19:09 UTC
Type: ---


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Network Time Protocol 2320 None None None Never

Description Doug Mitchell 2011-12-19 02:43:04 UTC
Description of problem:
The NTP query program ntpq runs very slowly because it is constantly re-reading /etc/services while running.

Version-Release number of selected component (if applicable):
ntp-4.2.6p4-1.fc16.i686

How reproducible:
1.  Start NTP with a few peers/servers, public is fine.
2.  Run:  strace -e open ntpq -pn
  
Actual results:
open("/etc/services", O_RDONLY|O_CLOEXEC) = 4
many many times

Expected results:
The /etc/services files should only be read in once.

Additional info:
Is this an NTP bug or a glibc bug?

Comment 1 Miroslav Lichvar 2011-12-19 16:09:03 UTC
This seems to come from the getaddrinfo() call in decodenetnum().

I'm not sure it's a bug. Enabling the nscd service seems to help.

Comment 2 Doug Mitchell 2011-12-22 00:20:14 UTC
(In reply to comment #1)
> This seems to come from the getaddrinfo() call in decodenetnum().
> 
> I'm not sure it's a bug. Enabling the nscd service seems to help.

So this means that glibc will read in /etc/services as many times as you call getaddrinfo in a program, and not save it in memory?  That just doesn't seem right...

So when I checked to see why nscd wasn't running, I found this:

[19697.471683] nscd[770]: segfault at 7473797b ip 002a36ff sp ac4f57b0 error 4 in nscd[28f000+24000]
[105137.569749] nscd[1533]: segfault at 7473797b ip 003856ff sp ac4f57b0 error 4 in nscd[371000+24000]

Do you want a separate bug for that?

Thanks,
Doug

Comment 3 Miroslav Lichvar 2011-12-22 13:55:32 UTC
Let's reassign this to glibc.

Comment 4 Jeff Law 2012-01-02 19:15:59 UTC
The kind of caching proposed seems wrong to add to glibc as nothing prevents the mapping from service name to port # from changing between invocations of getaddrinfo.

It would be better for ntp to get service port number once, then use the numeric port number is subsequent calls to getaddrinfo if you want to assume the port number does not change.   It may be advisable to set AI_NUMERICSERV in the hints.ai_flags structure as well to ensure that service points to a numeric string rather than a port name.

Comment 5 Fedora End Of Life 2013-02-14 02:04:00 UTC
Fedora 16 changed to end-of-life (EOL) status on 2013-02-12. Fedora 16 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 6 Miroslav Lichvar 2013-03-26 16:51:09 UTC
This problem is still present, reopening.

Comment 7 Fedora Update System 2013-04-02 17:57:05 UTC
ntp-4.2.6p5-11.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/ntp-4.2.6p5-11.fc19

Comment 8 Fedora Update System 2013-04-02 19:17:49 UTC
Package ntp-4.2.6p5-11.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing ntp-4.2.6p5-11.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-4660/ntp-4.2.6p5-11.fc19
then log in and leave karma (feedback).

Comment 9 Fedora End Of Life 2013-04-03 20:37:18 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.

(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19

Comment 10 Fedora Update System 2013-04-20 20:19:11 UTC
ntp-4.2.6p5-11.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.