[ https://issues.apache.org/jira/browse/KAFKA-1008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13739197#comment-13739197 ]
Jay Kreps commented on KAFKA-1008: ---------------------------------- Hey Elizabeth, thanks for the patch. Two issues. The first is that I think that instanceof check will actually throw an exception on a non-sun jvm. See the experiment below and see what you think. The second issue is actually a more subtle thing. Currently the synchronization is really just for changes to the buffer, the read-access are lock-free (which is good). My concern is what happens if we force clean a buffer while a read is occurring? Not sure if this can happen or not, but I think we need to somehow be sure it can't. Here was my test: $ cat /tmp/code/Test.java import test.MyTest; public class Test { public static void main(String[] args) { Object o = new Object(); if(o instanceof MyTest) System.out.println("Hello"); } } $ cat /tmp/code/test/MyTest.java package test; public class MyTest { } I do javac /tmp/code/test/MyTest.java javac -cp /tmp/code /tmp/code/Test.java rm /tmp/code/test/MyTest.class $ java -cp /tmp/code Test Exception in thread "main" java.lang.NoClassDefFoundError: test/MyTest at Test.main(Test.java:6) Caused by: java.lang.ClassNotFoundException: test.MyTest at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ... 1 more We also can't really be too sure what kind of exceptions clean() might throw. > 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-v2.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