[CalendarServer-dev] Exception in recvfd --was: Re: continuing work on FreeBSD ports
Axel Rau
Axel.Rau at Chaos1.DE
Thu Feb 21 11:06:21 PST 2013
Am 21.02.2013 um 01:15 schrieb glyph at twistedmatrix.com:
> Also, a Python traceback from the invocation of sendmsg() would be helpful.
I need some advice, how to do that.
> The 'ancillary' that your debug code is printing is the Python argument value for 'ancillary', which means that Python code is getting invoked with no ancillary list. There are only two invocations of sendmsg in the whole codebase, and the one that sends the FD is hard-coded to pass a list with one element in it along (in sendfd). sendmsg is also called to report status from the worker to the master, and that's expected to come along with no sendmsg arguments.
I suspect a portability issue in PyArg_ParseTupleAndKeywords().
This patch in twext.python.sendfd.recvfd:
---
data, flags, ancillary = recvmsg(socketfd)
[(cmsg_level, cmsg_type, packedFD)] = ancillary
# cmsg_level and cmsg_type really need to be SOL_SOCKET / SCM_RIGHTS, but
# since those are the *only* standard values, there's not much point in
# checking.
if len(packedFD) != calcsize("i"):
err_msg = str("recvfd: packedFD [%d] not %d bytes long" % (len(packedFD),calcsize("i")))
print err_msg
raise ValueError(err_msg)
[unpackedFD] = unpack("i", packedFD)
return (unpackedFD, data)
---
shows that there are 8 bytes returned for the fd instead of 4:
---
File "/usr/local/lib/python2.7/site-packages/twisted/internet/kqreactor.py", line 279, in _doWriteOrRead
why = selectable.doRead()
File "/usr/local/lib/python2.7/site-packages/Calendar_and_Contacts_Server-4.2-py2.7-freebsd-9.1-RELEASE-amd64.egg/twext/internet/sendfdport.py", line 281, in doRead
fd, description = recvfd(self.fd)
File "/usr/local/lib/python2.7/site-packages/Calendar_and_Contacts_Server-4.2-py2.7-freebsd-9.1-RELEASE-amd64.egg/twext/python/sendfd.py", line 72, in recvfd
raise ValueError(err_msg)
exceptions.ValueError: recvfd: packedFD [8] not 4 bytes long
---
Might platform related too.
Axel
---
PGP-Key:29E99DD6 ☀ +49 151 2300 9283 ☀ computing @ chaos claudius
More information about the calendarserver-dev
mailing list