loadquery failed error message displayed

Baesken, Matthias matthias.baesken at sap.com
Tue Jun 25 10:19:26 UTC 2019


Hi Steve, please create an issue + patch .

Btw.  I wonder also about   the other  loadquery  usages :


java_md_aix.c

static unsigned char dladdr_buffer[0x4000];

33 return loadquery(L_GETINFO, dladdr_buffer, sizeof(dladdr_buffer));


loadlib_aix.cpp

192 // Call loadquery(L_GETINFO..) to get a list of all loaded Dlls from AIX. loadquery
198 if (loadquery(L_GETINFO, buffer, buflen) == -1) {



Maybe you  could also adjust the  buffer size in  java_md_aix.c  as well  ?
(  The usage  in  loadlib_aix.cpp  uses a buffer reallocation  until the size is large enough.  )

Increasing by factor of 2  is fine with me .  But maybe some people prefer what we do in  loadlib_aix.cpp (reallocation at runtime ).




Best regards, Matthias


From: ppc-aix-port-dev <ppc-aix-port-dev-bounces at openjdk.java.net> On Behalf Of Thomas Stüfe
Sent: Mittwoch, 19. Juni 2019 19:21
To: Steve Groeger <GROEGES at uk.ibm.com>
Cc: ppc-aix-port-dev <ppc-aix-port-dev at openjdk.java.net>
Subject: Re: loadquery failed error message displayed

Hi Steve,

I wrote this a very long time ago and we never ran into this problem, curious that it took so long... but of course, please create an issue and do a patch, thanks!

I would probably just increase the buffer by factor 2 or 4.

Cheers, Thomas

On Wed, Jun 19, 2019, 14:19 Steve Groeger <GROEGES at uk.ibm.com<mailto:GROEGES at uk.ibm.com>> wrote:
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<mailto: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/20190625/46646146/attachment-0001.html>


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