loadquery failed error message displayed

Steve Groeger GROEGES at uk.ibm.com
Wed Jun 19 12:18:55 UTC 2019


Hi all, 

We have 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

Could / Should the size of these buffers be increased to handle the large 
data and prevent the error message from being displayed.
If so, I am happy to raise an issue and to generate a webrev for this. 
What would people suggest as a suitable size for the buffer, ie double the 
size (x8000) or something else?

Thanks
Steve Groeger
IBM Runtime Technologies
Hursley, Winchester
Tel: (44) 1962 816911  Mobex: 279990  Mobile: 07718 517 129
Fax (44) 1962 816800
Lotus Notes: Steve Groeger/UK/IBM
Internet: groeges at uk.ibm.com

Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/ppc-aix-port-dev/attachments/20190619/2b5f9c99/attachment.html>


More information about the ppc-aix-port-dev mailing list