Hi,

# cat /tmp/debug.dat.63406
recvmsg: fd [27] [0] result [1]
recvmsg: fd [25] [0] result [1]
#

2. After the error occured:

# cat /tmp/debug.dat.63431
recvmsg: fd [24] [0] result [3]
recvmsg: value:
d 0 0 0
---
Does this enlighten someone?
I don't know why there are still empty debug files.

Empty debugfiles are probably due to that recvmsg is just used by a few threads, but all threads initialize the sendmsg module. (eg makes a file)

It might be easier to debug in sendfd.py.
Just log what sendfd sends and recvfd receives.
From your output it looks like 3 bytes was sent and packedFD fails to unpack a 4 byte integer..



If this patch is used :
     recvmsg_result = recvmsg(fd, &message_header, flags);
+ fprintf(ddfp, "recvmsg: fd [%d] [%x] result [%x]\n",fd, flags, recvmsg_result);

It tells you that FD 24 without flags executed and the result was
3 (hex). (first not -1 which is an Error)

So I guess 3 hex, the recvmsg received 3 bytes.
13 0 0 in dec.

From the top of my head I find it strange that just 3 bytes was received.
If I remember correctly my tests sent more (with sendmsg).

some partial debug output :
sendmsg [4] 13
sendmsg [37f1ffe8][37f1ffd8]
[14][00][00][00][00][00][00][00][01][00][00][00][01][00][00][00][0e][00][00][00](20)

Here if I remember correctly the [0e][00][00][00] was the argument sent.
eg not to far away from your "d 0 0", but 3 bytes can not make an int.

entry = Py_BuildValue(
            "(iis#)",
            control_message->cmsg_level,
            control_message->cmsg_type,
            CMSG_DATA(control_message),
(Py_ssize_t) (control_message->cmsg_len - sizeof(struct cmsghdr)));

Creates the message to python "(iis#)" means
"s#" (string) [char *, int]
Convert a C string and its length to a Python object. If the C string pointer is NULL, the length is ignored and None is returned.

You can print the full messages with something like :
+           fprintf(ddfp, "sendmsg [%x][%x]\n", &cmsg_data, &control_message);
+           for (i=0;i<control_message->cmsg_len;i++) {
+                   fprintf(ddfp, "[%02x]", ((char* )control_message)[i]);
+           }
+           fprintf(ddfp, "(%d)\n",i);

to see what is sent and received.

man sendmsg and recvmsg has some details to the stucts.

/Fred
_______________________________________________
calendarserver-dev mailing list
calendarserver-dev@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/calendarserver-dev

Reply via email to