On Fri, 2012-10-19 at 11:13 -0300, Luiz Gustavo S. Costa wrote:
> why is that?
> 
> process in 100%
> 
> last pid: 22917;  load averages:  1.73,  1.89,  1.73
> 
>        up 2+01:27:52  11:12:00
> 47 processes:  3 running, 43 sleeping, 1 zombie
> CPU: 15.9% user,  0.0% nice,  9.1% system,  0.0% interrupt, 75.0% idle
> Mem: 68M Active, 1229M Inact, 558M Wired, 2932K Cache, 416M Buf, 2063M Free
> Swap: 8192M Total, 8192M Free
> 
>   PID USERNAME   THR PRI NICE   SIZE    RES STATE   C   TIME   WCPU COMMAND
> 22895 root         1 103    0   509M 54308K CPU6    6   1:06 100.00%
> samba: task[cldapd] (samba)
> 22896 root         1 103    0   509M 54720K CPU3    3   1:06 100.00%
> samba: task[kdc] (samba)

Luiz,

Attached is a patch metze provided that should fix this.

I attempted to validate this earlier, but ran into other issues with
FreeBSD and our make test environment, so I don't think proceeded. 

If you can validate the patch, I think we get get it into the RC
releases.  

Note that per the release notes we still have an outstanding issue with
FreeBSD rejecting lookup of names containing _.  

We don't currently have a workaround for this platform limitation. 

Andrew Bartlett

-- 
Andrew Bartlett                                http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org

>From 87b2fee3c17d47ff5b21a1eaa5a9aaa71c0b1bb6 Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <[email protected]>
Date: Tue, 2 Oct 2012 12:20:26 +0200
Subject: [PATCH] lib/tsocket: fix loop in tdgram_bsd_recvfrom() (bug #9184)

If the socket is not readable yet, we need to retry
if tsocket_bsd_pending() returns 0.

See also
https://lists.samba.org/archive/samba-technical/2012-October/087164.html

metze
---
 lib/tsocket/tsocket_bsd.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/tsocket/tsocket_bsd.c b/lib/tsocket/tsocket_bsd.c
index d5721b4..135fd02 100644
--- a/lib/tsocket/tsocket_bsd.c
+++ b/lib/tsocket/tsocket_bsd.c
@@ -792,7 +792,7 @@ static int tdgram_bsd_set_writeable_handler(struct tdgram_bsd *bsds,
 
 struct tdgram_bsd_recvfrom_state {
 	struct tdgram_context *dgram;
-
+	bool first_try;
 	uint8_t *buf;
 	size_t len;
 	struct tsocket_address *src;
@@ -826,6 +826,7 @@ static struct tevent_req *tdgram_bsd_recvfrom_send(TALLOC_CTX *mem_ctx,
 	}
 
 	state->dgram	= dgram;
+	state->first_try= true;
 	state->buf	= NULL;
 	state->len	= 0;
 	state->src	= NULL;
@@ -876,6 +877,13 @@ static void tdgram_bsd_recvfrom_handler(void *private_data)
 	bool retry;
 
 	ret = tsocket_bsd_pending(bsds->fd);
+	if (state->first_try && ret == 0) {
+		state->first_try = false;
+		/* retry later */
+		return;
+	}
+	state->first_try = false;
+
 	err = tsocket_bsd_error_from_errno(ret, errno, &retry);
 	if (retry) {
 		/* retry later */
-- 
1.7.11.7

-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba

Reply via email to