[zeromq-dev] Assert on pgm_getsockopt (Win7 x64, ZMQ 2.1.7, OpenPGM 5.1.116 )

Scott Asher scottpriceasher at gmail.com
Wed Aug 17 17:13:38 CEST 2011


Howdy,

I am very confused.

Some time after binding a very simple pub socket using epgm (i.e. during the
attempt to process the "attach" command int he ZMQ thread), I am receiving
an assert at the following location ( line 437, pgm_socket.cpp ):

 rc = pgm_getsockopt (sock, IPPROTO_PGM, PGM_SEND_SOCK, send_fd_, &socklen);
 zmq_assert (rc);

The false return value is caused within OpenPGM itself ( socket.c89.c ) at
the following line:

    if (PGM_UNLIKELY(*optlen != sizeof (SOCKET)))
            break;

Now ultimately this is caused because zmq::pgm_socket_t::get_sender_fds
takes an int *send_fd_:

void zmq::pgm_socket_t::get_sender_fds (int *send_fd_, int *receive_fd_,
    int *rdata_notify_fd_, int *pending_notify_fd_)
{

And then within the body of get_sender_fds, you set:

socklen = sizeof (*send_fd_);

Then optlen becomes a pointer to socklen in the pgm code above, and *optlen
= 4 (sizeof(*send_fd_), i.e. sizeof(int)).

However, we are comparting this to sizeof(SOCKET) which has:

typedef UINT_PTR        SOCKET;'

And UINT_PTR has:

typedef unsigned __int64 UINT_PTR, *PUINT_PTR;

And sizeof(_int64) == 8 (obviously).

How does this code ever work?  What am I missing here?  I have compiled both
OpenPGM and ZMQ 2.1.7 in x64.

Thanks,
Scott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110817/ef57d67d/attachment.htm>


More information about the zeromq-dev mailing list