You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Ivan Kelly (JIRA)" <ji...@apache.org> on 2010/11/03 10:14:26 UTC

[jira] Updated: (ZOOKEEPER-916) Problem receiving messages from subscribed channels in c++ client

     [ https://issues.apache.org/jira/browse/ZOOKEEPER-916?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ivan Kelly updated ZOOKEEPER-916:
---------------------------------

    Attachment: ZOOKEEPER-916.patch

> Problem receiving messages from subscribed channels in c++ client 
> ------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-916
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-916
>             Project: Zookeeper
>          Issue Type: Bug
>          Components: contrib-hedwig
>            Reporter: Ivan Kelly
>            Assignee: Ivan Kelly
>         Attachments: ZOOKEEPER-916.patch
>
>
> We see this bug with receiving messages from a subscribed channel.  This problem seems to happen with larger messages.  The flow is to first read at least 4 bytes from the socket channel. Extract the first 4 bytes to get the message size.  If we've read enough data into the buffer already, we're done so invoke the messageReadCallbackHandler passing the channel and message size.  If not, then do an async read for at least the remaining amount of bytes in the message from the socket channel.  When done, invoke the messageReadCallbackHandler.
> The problem seems that when the second async read is done, the same sizeReadCallbackHandler is invoked instead of the messageReadCallbackHandler.  The result is that we then try to read the first 4 bytes again from the buffer.  This will get a random message size and screw things up.  I'm not sure if it's an incorrect use of the boost asio async_read function or we're doing the boost bind to the callback function incorrectly.
> 101015 15:30:40.108 DEBUG hedwig.channel.cpp - DuplexChannel::sizeReadCallbackHandler system:0,512 channel(0x80b7a18)
> 101015 15:30:40.108 DEBUG hedwig.channel.cpp - DuplexChannel::sizeReadCallbackHandler: size of buffer before reading message size: 512 channel(0x80b7a18)
> 101015 15:30:40.108 DEBUG hedwig.channel.cpp - DuplexChannel::sizeReadCallbackHandler: size of incoming message 599, currently in buffer 508 channel(0x80b7a18)
> 101015 15:30:40.108 DEBUG hedwig.channel.cpp - DuplexChannel::sizeReadCallbackHandler: Still have more data to read, 91 from channel(0x80b7a18)
> 101015 15:30:40.108 DEBUG hedwig.channel.cpp - DuplexChannel::sizeReadCallbackHandler system:0, 91 channel(0x80b7a18)
> 101015 15:30:40.108 DEBUG hedwig.channel.cpp - DuplexChannel::sizeReadCallbackHandler: size of buffer before reading message size: 599 channel(0x80b7a18)
> 101015 15:30:40.108 DEBUG hedwig.channel.cpp - DuplexChannel::sizeReadCallbackHandler: size of incoming message 134287360, currently in buffer 595 channel(0x80b7a18)
> 101015 15:30:40.108 DEBUG hedwig.channel.cpp - DuplexChannel::sizeReadCallbackHandler: Still have more data to read, 134286765 from channel(0x80b7a18)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.