[CalendarServer-users] calendarserver 3.2 on Debian unstable throwing error "socket.error: [Errno 22] Invalid argument" out of the box?

Fredrik Unger fred at tree.se
Thu Jul 12 05:50:44 PDT 2012


Hi,

In spring I tried just to hack up a 3.X version with debian.
I were not able to complete it due other obligations and now I decided to 
have a look at the debian version again. Nice that a package was made.

I can confirm the "bug" using 3.2.0-3-rt-amd64.
Using the source package from debian (apt-get source calendarserver)
I added some debug information in the python file, and get :

    print SOL_SOCKET
    print SCM_RIGHTS
    print socketfd
    print fd
    sendmsg(
        socketfd, description, 0, [(SOL_SOCKET, SCM_RIGHTS, pack("i", fd))]
    )


2012-07-12 12:35:45+0200 [-] 1
2012-07-12 12:35:45+0200 [-] 1
2012-07-12 12:35:45+0200 [-] 18
2012-07-12 12:35:45+0200 [-] 33
2012-07-12 12:35:45+0200 [-] Unhandled Error

Now :
The header definitions I found so far matches.. 
/usr/src/linux-headers-3.2.0-3-common/include/linux/socket.h:#define    SCM_RIGHTS      0x01            /* rw: access rights (array of int) */
/usr/src/linux-headers-3.2.0-3-common/include/asm-generic/socket.h:#define SOL_SOCKET   1

I have yet to look at the structs.. 

The message is sent in "twext/python/sendmsg.c" line 273, 

I added debug infomation to what is going on, 

fprintf(ddfp, "fd: %d, mesg: %s %d control : %d, flags: %x",fd,message_header.msg_name,message_header.msg_namelen,message_header.msg_controllen,flags);

it was a bit tricky (i open a pid debug file and write to it), but got this output on a failing run :

(line 175ish in sendmsg.c, after PyArg_ParseTuple.)

 fprintf(ddfp, "level: %d , type: %d data %d :\n",level,type,data_len);
 fprintf(ddfp, "%x %x %x %x\n",data[0],data[1],data[2],data[3]);

level: 1 , type: 1 data 4 :
20 0 0 0
fd: 16 10, mesg: (null) 0 control : 24, flags: 0

level: 1 , type: 1 data 4 :
21 0 0 0
fd: 18 12, mesg: (null) 0 control : 24, flags: 0

20 and 21 is hex, so 32, 33 which is correct.
Size 4 matches int, but need to check if the order is ok.

I will have to look further to what goes wrong with the format
of the call to sendmsg, when I have time.

Found some pointers to 
http://www.normalesup.org/~george/comp/libancillary/
Maybe that can be used to simplify the setup. 
(depending on license and os compatibility)

/Fred

On Tue, 10 Jul 2012 14:39:06 -0700
Glyph <glyph at twistedmatrix.com> wrote:
> On Jul 10, 2012, at 8:22 AM, tobiasbp <tobiasbp at gmail.com> wrote:
> 
> > 	    socketfd, description, 0, [(SOL_SOCKET, SCM_RIGHTS, pack("i", fd))]
> > 	socket.error: [Errno 22] Invalid argument
> > 
> > Any ideas?
> 
> My first guess would be "kernel bug".  Any chance you can test with an older kernel?
> 
> -glyph
> 




More information about the calendarserver-users mailing list