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

Chris Nauroth commented on ZOOKEEPER-2227:
------------------------------------------

Hello [~arshad.mohammad].  Thank you for reviewing.

bq. After applying your patch, when this mask is set netcat using echo stmk 
1022|netcat host port, java.nio.BufferUnderflowException exception is thrown.

{{stmk}} expects as input the 64-bit binary integral value (Java {{long}}) 
containing the mask, not a text representation like the example shown above.  
Therefore, we must parse exactly 8 bytes.

It takes some extra work in the shell to encode a trace mask value like this.  
In ZOOKEEPER-2229, I'm updating documentation for some of the four-letter 
words.  Here is an example I gave for one way to encode the argument properly:

{code}
perl -e "print 'stmk', pack('q>', 0b0011111010)" | nc localhost 2181
{code}

This is admittedly a strange interface compared to the other four-letter words. 
 I think all of the other four-letter words accept text input instead of 
binary.  However, I approached this patch as just restoring the existing 
functionality that had been broken in ZOOKEEPER-572, not changing the 
interface, for reasons of backwards-compatibility.

> stmk four-letter word fails execution at server while reading trace mask 
> argument.
> ----------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-2227
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2227
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 3.3.0
>            Reporter: Chris Nauroth
>            Assignee: Chris Nauroth
>         Attachments: ZOOKEEPER-2227.001.patch, ZOOKEEPER-2227.002.patch
>
>
> When the server handles the {{stmk}} four-letter word, it attempts to read an 
> 8-byte Java {{long}} from the request as the trace mask argument.  The read 
> fails, because the destination buffer's capacity is only 4 bytes.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to