Alan Burlison created HDFS-9957:
-----------------------------------

             Summary: HDFS's use of mlock() is not portable
                 Key: HDFS-9957
                 URL: https://issues.apache.org/jira/browse/HDFS-9957
             Project: Hadoop HDFS
          Issue Type: Sub-task
          Components: native
    Affects Versions: 2.7.2
         Environment: Any UNIX system other than Linux
            Reporter: Alan Burlison


HDFS uses mlock() to lock in the memory used to back java.nio.Buffer. 
Unfortunately the way it is done is not standards-compliant. As the Linux 
manpage for mlock() says:

{quote}
       Under Linux, mlock(), mlock2(), and munlock() automatically round
       addr down to the nearest page boundary.  However, the POSIX.1
       specification of mlock() and munlock() allows an implementation to
       require that addr is page aligned, so portable applications should
       ensure this.
{quote}

The HDFS code does not do any such alignment, nor is it true that the backing 
buffers for java.nio.Buffer are necessarily page aligned. And even if the 
address was aligned by the code, it would end up calling mlock() on other 
random JVM data structures that shared the same page. That seems potentially 
dangerous.



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

Reply via email to