Details

    • Improvement
    • Status: Resolved
    • Low
    • Resolution: Fixed
    • 2.1.15, 2.2.7, 3.0.8, 3.8
    • Legacy/Core
    • None
    • POWER architecture

    Description

      org.apache.cassandra.utils.CLibrary contains hard-coded C-macro values to be passed to system calls through JNA. These values are system-dependent, and as far as I investigated, Linux and AIX on the IBM POWER architecture define MCL_CURRENT and MCL_FUTURE (for mlockall(2)) as different values than the current hard-coded values. As a result, mlockall(2) fails on these platforms.

      WARN  18:51:51 Unknown mlockall error 22
      

      I am going to provide a patch to support JNA mlockall(2) on POWER.

      Attachments

        1. 11576-2.1.txt
          2 kB
          Rei Odaira

        Activity

          Correct me if I'm wrong, but referencing this page (or this for 4.6 kernel), it looks like MCL_CURRENT and MCL_FUTURE on PPC are defined as:

           26 #define MCL_CURRENT     0x2000          /* lock all currently mapped pages */
           27 #define MCL_FUTURE      0x4000          /* lock all additions to address space */
          

          As those are hexadecimal values, the following code would be incorrect:

                  if (System.getProperty("os.arch").toLowerCase().contains("ppc"))
                  {
                   if (System.getProperty("os.name").toLowerCase().contains("linux"))
                   {
                      MCL_CURRENT = 020000;
                      MCL_FUTURE = 040000;
                   }
          

          I haven't dug into the aix values.

          JoshuaMcKenzie Joshua McKenzie added a comment - Correct me if I'm wrong, but referencing this page (or this for 4.6 kernel), it looks like MCL_CURRENT and MCL_FUTURE on PPC are defined as: 26 #define MCL_CURRENT 0x2000 /* lock all currently mapped pages */ 27 #define MCL_FUTURE 0x4000 /* lock all additions to address space */ As those are hexadecimal values, the following code would be incorrect: if (System.getProperty("os.arch").toLowerCase().contains("ppc")) { if (System.getProperty("os.name").toLowerCase().contains("linux")) { MCL_CURRENT = 020000; MCL_FUTURE = 040000; } I haven't dug into the aix values.
          ReiOdaira Rei Odaira added a comment -

          Sorry for the confusion, but 0x2000 == 020000 and 0x4000 == 040000. If they should be in hexadecimal numbers, I can fix the patch.

          ReiOdaira Rei Odaira added a comment - Sorry for the confusion, but 0x2000 == 020000 and 0x4000 == 040000. If they should be in hexadecimal numbers, I can fix the patch.

          Oh, I missed the fact that you were going the octal route. How about we keep them as hex so we have consistency w/the original declaration they're referring to?

          JoshuaMcKenzie Joshua McKenzie added a comment - Oh, I missed the fact that you were going the octal route. How about we keep them as hex so we have consistency w/the original declaration they're referring to?
          ReiOdaira Rei Odaira added a comment -

          I have updated the patch.

          ReiOdaira Rei Odaira added a comment - I have updated the patch.

          Went ahead and commit to 2.1 and merged up, as this is a very non-invasive change.

          Thanks for the patch!

          JoshuaMcKenzie Joshua McKenzie added a comment - Went ahead and commit to 2.1 and merged up, as this is a very non-invasive change. Thanks for the patch!

          People

            ReiOdaira Rei Odaira
            ReiOdaira Rei Odaira
            Rei Odaira
            Joshua McKenzie
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: