Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8226468

[aix] loadquery failed error reported

    XMLWordPrintable

Details

    • b03
    • aix

    Backports

      Description

        There is a scenario where in a Java program after loading some shared
        libraries (using System.loadLibrary) and then calling
        javax.imageio.ImageIO.read(new File(..)) the java program displays the
        following error message:

        loadquery failed (12 Not enough space)

        This happens when running on AIX with Java 11 using this sample code:

        import java.io.File;
        import java.util.Map;
        import javax.imageio.ImageIO;
        public class Reproduce {
            public static void main(String[] args) {
                try {
                    System.loadLibrary("mylib");

                    String filePath = "...";
                    BufferedImage img = ImageIO.read(new File(filePath));

                }
                catch (Throwable e) {
                    System.out.println("Exception : " + e);
                    e.printStackTrace();
                }
            }
        }

        It seems that this is displayed from
        src/java.desktop/aix/native/libawt/porting_aix.c

        static unsigned char dladdr_buffer[0x4000];

        static void fill_dll_info(void) {
          int rc = loadquery(L_GETINFO,dladdr_buffer, sizeof(dladdr_buffer));
          if (rc == -1) {
            fprintf(stderr, "loadquery failed (%d %s)", errno, strerror(errno));
            fflush(stderr);
          }
        }

        and is due to the dladdr_info buffer being too small to contain all the
        data returned from the loadquery function.

        The same buffer size is also used in
        src/java.base/aix/native/libjli/java_md_aix.c

        Attachments

          Issue Links

            Activity

              People

                stuefe Thomas Stuefe
                sgroeger Steve Groeger
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: