On Thu, 5 Jan 2006, Alan Robertson wrote: > David Lee wrote: > > [...] > > For me, it fails, as the client is trying to write "String-2". After much > > tedious insertion of debugging statements, I have pinned it down. The > > "client" process of ipctest crashes in "socket_resume_io_write()" at the > > statement: > > head->msg_len = msg->msg_len > > > > Sure enough "head", on this occasion, is not cleanly aligned for an "int". > > (I suspect that there will also be similar assignments with similar > > problems: for instance I see one in the line following the one above!) > > > > Further when I run this on Linux (although "Intel" might be a better > > technical interpretation) all is well: these unaligned assignments are > > still present, but work fine. > > > > > > Secondly: a specific query to the developers: Could you confirm that the > > above analysis is reasonable? If so, how do we set about addressing this > > problem, and its instances? Should we be using "memcpy" for such > > instances? > > Malloc is supposed to ALWAYS return storage which is sufficiently > aligned for any purpose. It sounds like it's not. (didn't this come up > before on Solaris?) > > What libc are you using?
Yes, it did come up before a couple of times: they turned out to be problems in heartbeat coding rather than libc. One of the occasions was also in "ipcsocket.c" itself (fixed in v.1.160). Indeed, that itself also involved this same "(struct SOCKET_MSG_HEAD)" item. "malloc" does behave nicely. But I think what we are seeing here is probably heartbeat's mapping onto such space. The code in "ipcsocket" is rather tricky to understand. But I suspect that it may be something like the "pool" stuff mapping many relatively small structures (requiring alignment) onto nonaligned locations within a single, big, malloc'd block. I've done a "memcpy()" version, and this seems to fix the problem (and continue to work on Linux!) So I propose applying a "memcpy()" patch in the next (working) day or so. -- : David Lee I.T. Service : : Senior Systems Programmer Computer Centre : : Durham University : : http://www.dur.ac.uk/t.d.lee/ South Road : : Durham DH1 3LE : : Phone: +44 191 334 2752 U.K. : _______________________________________________________ Linux-HA-Dev: [email protected] http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev Home Page: http://linux-ha.org/
