Port-sparc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ntpd wedged by libc?



On 3/9/2012 11:19, Dave Hart wrote:
On Fri, Mar 9, 2012 at 17:02, David Brownlee<abs%netbsd.org@localhost>  wrote:
On 7 March 2012 22:29, AGC<agcarver+netbsd%acarver.net@localhost>  wrote:
On 3/7/2012 13:57, Dave Hart wrote:

Yes, when it wedges it uses upwards of 80-90% CPU according to top but is
otherwise unresponsive unless issued a SIGKILL, SIGTERM, or SIGHUP. I attach
gdb to it while it's spinning the CPU that's where I get the stack trace.
  Interestingly a simple SIGTERM will break the loop and ntpd will actually
close out normally -- it issues the exit messages in the logs about
releasing kernel discipline and then message "exit on signal 15" (or
whatever the number is for a kill command with no signal flag, I don't
recall).

Apologies if I've misunderstood something here, but if using the hand
rolled snprintf does not use dtoa() and avoids the issue would it make
sense to try one of:

a) Modify the hand rolled snprintf to use dtoa() to confirm it is the
dtoa() calls, plus have it keep a static fd open and just write out
the argument before calling each dtoa(). If it hangs, you have a
history of dtoa() calls which you can replay in a test app to see
which bit pattern or sequence of bit patterns causes the issue.

Attached and inlined below is a patch to ntpd's replacement snprintf()
to log floating point values as hex dumps to "printf_dtoa.log" then
call dtoa(), though it doesn't actually use dtoa's text conversion
result.  AGC, if you apply this patch and rebuild ntpd (configured
with --enable-C99-snprintf) the log could be very helpful assuming it
eventually spins infinitely inside dtoa().

The code compiles but I don't have dtoa() on this system to test with,
so I haven't tested it.

Cheers,
Dave Hart

The patch took but the compile fails:

# make
[ ! -r ./../COPYRIGHT ] || [ check-COPYRIGHT-submake -nt ./../COPYRIGHT ] || make check-COPYRIGHT-submake
cd . &&  ./scripts/checkChangeLog
make  all-recursive
Making all in scripts
Making all in include
Making all in isc
Making all in libntp
make  all-am
  CC     snprintf.o
snprintf.c: In function 'fmtflt':
snprintf.c:1108: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
snprintf.c:1108: error: 'puch' undeclared (first use in this function)
snprintf.c:1108: error: (Each undeclared identifier is reported only once
snprintf.c:1108: error: for each function it appears in.)
*** Error code 1

Stop.
make: stopped in /usr/src/ntp-dev-4.2.7p259/libntp
*** Error code 1

Stop.
make: stopped in /usr/src/ntp-dev-4.2.7p259/libntp
*** Error code 1

Stop.
make: stopped in /usr/src/ntp-dev-4.2.7p259
*** Error code 1

Stop.
make: stopped in /usr/src/ntp-dev-4.2.7p259


Home | Main Index | Thread Index | Old Index