IBM Support

PI97686: OPENJPA QUERY CACHE MISS RESULTS IN CLASSCASTEXCEPTION

Subscribe to this APAR

By subscribing, you receive periodic emails alerting you to the status of the APAR, along with a link to the fix after it becomes available. You can track this item individually or track all items by product.

Notify me when this APAR changes.

Notify me when an APAR for this component changes.

APAR status

  • Closed as program error.

Error description

  • The investigation and proposed fix to OpenJPA has been
    documented in this OpenJPA JIRA:
    https://issues.apache.org/jira/browse/OPENJPA-2646.
    
    The issue comes down to a VERY narrow race condition that
    occurs in OpenJPA's cache overflow swapping. OpenJPA maintains
    a query cache that consists of a "hard" cache map with a
    default size of 1000 (this is not configurable) and a "soft"
    cache map. When the hard cache map reaches the max size,
    OpenJPA starts evicting random entries into the soft cache to
    maintain the hard cache size limit. During this migration,
    there exists a very small moment in time were the random entry
    has been removed from the hard cache and has not yet been
    entered into the soft cache. This alone would not be a big
    issue for OpenJPA, except further investigation showed that
    OpenJPA was not using proper synchronization. This allowed
    dirty reads of the cache to occur, resulting in seemingly
    random cache misses.
    
    The CCE the customer is experiencing stemmed from OpenJPA
    "seeing" the query entry in the cache, but upon reading the
    value, returning a null result. That code path, at the wrong
    read time, resulted in OpenJPA missing a "re-parameterization"
    section of code to prevent java.lang.String values from being
    used.
    

Local fix

  • N/A
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  All users of IBM WebSphere Application      *
    *                  Server                                      *
    ****************************************************************
    * PROBLEM DESCRIPTION: While executing queries in              *
    *                      batch, a sporadic ClassCastException    *
    *                      can occur when QuerySQLCache is         *
    *                      enabled                                 *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    With OpenJPA's QuerySQLCache enabled, there exists the
    possibility for a random exception to occur while executing a
    query. This will only occur in a multi-threaded environment,
    most likely while running many queries in batch. Please read
    https://issues.apache.org/jira/browse/OPENJPA-2646 for a more
    indepth explanation of the issue if you believe this is an
    exception you are seeing.
    Exception:
    Caused by: java.lang.ClassCastException: java.lang.String
    incompatible with java.lang.Integer
    at
    org.apache.openjpa.jdbc.kernel.PreparedSQLStoreQuery$PreparedSQL
    Executor.toParameterArray(PreparedSQLStoreQuery.java:160)
    at
    org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:857)
    

Problem conclusion

  • The fix for this APAR changes the OpenJPA implementation and
    involves an update to the OpenJPA thirdparty bundle. See
    https://issues.apache.org/jira/browse/OPENJPA-2646
    
    The fix for this APAR is currently targeted for inclusion in
    Service Level (Fix Pack) 9.0.0.9 of WebSphere Application
    Server version 9.0, Service Level (Fix Pack) 8.5.5.15 of
    WebSphere Application Server version 8.5, and in fix pack
    18.0.0.3 for WebSphere Application Server Liberty. Please
    refer to the Recommended Updates page for delivery information:
    http://www.ibm.com/support/docview.wss?rs=180&uid=swg27004980
    

Temporary fix

Comments

APAR Information

  • APAR number

    PI97686

  • Reported component name

    WEBS APP SERV N

  • Reported component ID

    5724H8800

  • Reported release

    850

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2018-05-07

  • Closed date

    2018-08-06

  • Last modified date

    2018-08-06

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    WEBS APP SERV N

  • Fixed component ID

    5724H8800

Applicable component levels



Document information

More support for: WebSphere Application Server
General

Software version: 850

Reference #: PI97686

Modified date: 06 August 2018


Translate this page: