Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Feb 2013 11:25:17 GMT
From:      Kajetan Staszkiewicz <kajetan.staszkiewicz@innogames.de>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/176438: nrpe2 consuming cpu when handling new connections
Message-ID:  <201302261125.r1QBPHTF082435@red.freebsd.org>
Resent-Message-ID: <201302261130.r1QBU135031423@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         176438
>Category:       ports
>Synopsis:       nrpe2 consuming cpu when handling new connections
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 26 11:30:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Kajetan Staszkiewicz
>Release:        9.1-RELEASE
>Organization:
InnoGames GmbH
>Environment:
FreeBSD xxxxxxx 9.1-RELEASE FreeBSD 9.1-RELEASE #10 r247265M: Mon Feb 25 14:58:39 CET 2013     root@xxxxx:/usr/obj/usr/src/sys/IGLB3  amd64
>Description:
When nrpe2 built with SSL support accepts a new connection, it enters a loop waiting for SSL handshake. If no handshake occurs but the tcp connection is established, the loop consumes all available cpu time.

1004             /* keep attempting the request if needed */
1005                         while(((rc=SSL_accept(ssl))!=1) && (SSL_get_error(ssl,rc)==SSL_ERROR_WANT_READ));

I've observed this behavior on FreeBSD 9.0 and 9.1, I was told it happens also on 6.x.

This does not happen on nrpe2 running on Debian. Running strace/gdb on the process shows that in Linux it is waiting on read(), while on FreeBSD it iterates the loop over and over very fast.
>How-To-Repeat:
`telnet localhost 5666` is enough to observe 100% cpu usage in top.
>Fix:
A dirty hack is to add usleep(100000) in the aforementioned loop.

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201302261125.r1QBPHTF082435>