[ 
https://issues.apache.org/jira/browse/BOOKKEEPER-79?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13127336#comment-13127336
 ] 

Sijie Guo commented on BOOKKEEPER-79:
-------------------------------------

Did investigation on startDelivery/stopDelivery. 
I found that stopDelivery just set flag *receiving* as false without doing 
other things.

Let me explain the startDelivery/stopDelivery flow.

startDelivery:
1) check if *receiving* is true
2) if *receiving* is true, it just return without doing anything. since it has 
been started.
3) if *receiving* is false, it set *receiving* as true. and put an async io 
read in boost io queue to read 4bytes message size.
4) if async sizeRead succeed, it will trigger sizeReadCallback and put an async 
io read in boost io queue to read actual message data.

if we just startDelivery without stopDelivery, the boost io queue will be:

> boost io queue <
| read size |
| read msg |
| read size |
| read msg |
| ... |

but if we first startDelivery (1) -> stopDelivery (1) -> startDelivery (2), 
the second delivery will add another read size io in the queue, then it will be:

> boost io queue <
| read size |
| read msg |
| ... |
| *read size* |
| *read size* |
| read msg |

so the data stream is corrupted which will cause memory corrupted. it core dump.
                
> randomly startDelivery/stopDelivery will core dump in c++ hedwig client
> -----------------------------------------------------------------------
>
>                 Key: BOOKKEEPER-79
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-79
>             Project: Bookkeeper
>          Issue Type: Bug
>          Components: hedwig-client
>    Affects Versions: 3.4.0
>            Reporter: Sijie Guo
>
> in our test program, we tried to startDelivery/stopDelivery different 
> subscriptions randomly. And it core dump.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to