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

Jay Kreps commented on KAFKA-1008:
----------------------------------

But my understanding is that these copies are just copies of pointer object 
(i.e. a position, limit, mark, etc) so if you unmap the underlying mmap while 
reads are occurring something bad will happen.

Another way to say this is what happens in the following code execution:
MappedByteBuffer orig = // map file
MappedByteBuffer copy = orig.duplicate()
(orig.asInstanceOf[sun.nio.ch.DirectBuffer]).cleaner().clean()
copy.get()

My suspicion is that something terrible will happen, but I could be wrong.
                
> Unmap before resizing
> ---------------------
>
>                 Key: KAFKA-1008
>                 URL: https://issues.apache.org/jira/browse/KAFKA-1008
>             Project: Kafka
>          Issue Type: Bug
>          Components: core, log
>    Affects Versions: 0.8
>         Environment: Windows, Linux, Mac OS
>            Reporter: Elizabeth Wei
>            Assignee: Jay Kreps
>              Labels: patch
>             Fix For: 0.8
>
>         Attachments: unmap-v4.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> While I was studying how MappedByteBuffer works, I saw a sharing runtime 
> exception on Windows. I applied what I learned to generate a patch which uses 
> an internal open JDK API to solve this problem.
> Following Jay's advice, I made a helper method called tryUnmap(). 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to