Bug: Generating prelink cache breaks JAVA 'jinfo' utility normal behaviour

Carlos Santos casantos at redhat.com
Tue Mar 18 18:11:13 UTC 2014


Hello,

My name is Carlos Santos and I'm a Red Hat software maintenance engineer. Recently a customer noticed that running prelink to generate its cache causes the OpnJDK "jinfo" utility to fail. I'm transcribing below our internal bug report.

Version-Release number of selected component (if applicable):

java-1.7.0-openjdk-1.7.0.51-2.4.4.1.el6_5

How reproducible:

Always

Steps to Reproduce:

1. export LIBSAPROC_DEBUG=1
2. yum install -y java-1.7.0-openjdk-devel
3. javac TCPServer.java (see attachment)
4. prelink -ua
5. java TCPServer &     (take the process pid)
6. jinfo <pid>          (works, lots of information shown)
7. prelink -a
8. jinfo <pid>          (fails, lots of information shown)

Actual results:

Step 8 fails, the message below is shown and the Java vm is kept stopped.

   [1]+  Stopped                 java TCPServer

Expected results:

All steps should succeed.

Additional info:

The problem happens because when prelink runs while the Java VM is running the format of the proc/<pid>/maps file changes to a funky format:

  - Libraries that are to be ignored receive a trailing " (deleted)"
  - Libraries that are provided by the prelink cache receive a trailing ".#prelink#.xyTMjC (deleted)"

This leads jinfo to fail parsing the maps file.

The problem can be fixed by means of the attached patch (java-1.7.0-openjdk-debug-prelink.patch).

Changes in function nfo_fd (file openjdk/hotspot/agent/src/os/linux/ps_proc.c):

  - Discard libraries that must be ignored.
  - Remove the the trailing ".#prelink#.xyTMjC (deleted)" from the names of libraries that must not be discarded
  - Add debug messages about discarded and kept shared objects.

Changes in function add_lib_info_fd (file openjdk/hotspot/agent/src/os/linux/libproc_impl.c):

  - Save library base address at newlib->base. It was being left as null, which led to failures searching for symbols in the shared objects.
  - Fixed/enhanced debug messages.

I attempted to open an account in the OpenJDK bug tracking system to submit the report there but did not find a way. The instructions at

    http://openjdk.java.net/contribute/

say that I need to submit a signed OCA, but I was told that Red Hat employees are already covered by the OCA.

Thanks in advance for your help.

Carlos Santos (casantos)
Senior *Software* Maintenance Engineer
(no, I'm not going to fix your roof)
Red Hat, Inc




More information about the hotspot-dev mailing list