You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-dev@hadoop.apache.org by "Alan Burlison (JIRA)" <ji...@apache.org> on 2016/03/14 18:03:33 UTC

[jira] [Created] (HDFS-9957) HDFS's use of mlock() is not portable

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)