EVALUATION
The reason of -Xcheck:jni warnings in readImageHeader() method was
invocation of the setImageData() method in the critical section.
Numerous warnings in the writeImage() method were caused by handling
encoding tables (that requires number of jni calls) inside critical
section. However, we can get output buffer array later, after
completion of encoding tables processing.
|
|
|
EVALUATION
We have an important demo app that loads a ton of JPEG files and triggers
this bug, so when -Xcheck:jni is enabled it makes it very difficult to see
if there are any JNI-related issues other than the one reported here. We should
fix this for Mustang if possible. The most reproducible case is the one
reported in the description field: in imageioJPEG.c, in the readImageHeader()
method we call read_icc_profile() within a GET/RELEASE pair, which in turn calls
into various CMM functions that make JNI calls. For each one of those JNI calls
another -Xcheck:jni warning is emitted which causes a lot of confusing spew to
the console. We should be able to fix this by calling RELEASE_ARRAYS() before
the CallVoidMethod(setImageDataID). It should be easy to reproduce this bug by
reading a JPEG image with an embedded color profile.
|
|
|
SUGGESTED FIX
Unfortunately the line numbers above are no longer accurate, so we should
probably look through the code for possible problem areas.
|
|
|
PUBLIC COMMENTS
The native JPEG code for Image I/O is making a number of JNI method calls
when it has a lock (inside of a Get/ReleasePrimitiveArrayCritical pair). This
is unlikely to cause problems in any application, but the offending code
should be reworked so we conform to the JNI specification.
|
|
|
EVALUATION
We should make sure all Java upcalls in imageioJPEG.c are surrounded with a
RELEASE/GET_ARRAYS pair (as enumerated in the suggested fix). We can use the
non-standard -Xcheck:jni flag to verify that all offending code has been
properly reorganized.
###@###.### 2001-11-16
|
|
|
SUGGESTED FIX
Ensure all JNI method calls in imageioJPEG.c are appropriately wrapped in a
RELEASE/GET_ARRAYS macro pair. The method calls on the following lines in
imageioJPEG.c are suspect: 1608, 1843, 1848, 1930, 2320-2344, and 2486-2604.
###@###.### 2001-11-16
|
|
|