-
Notifications
You must be signed in to change notification settings - Fork 189
Description
After upgrading to eclipselink 2.7.11, we have seen a issue where criteria query which is using either coalesce or selectcase function is throwing Nullpointerexception under stress.
We also see that bug is not db dependent or platform dependent. We are able to reproduce with oracle and postgres db while running on weblogic or with helidon mp.
exception is ::
at org.eclipse.persistence.exceptions.QueryException.prepareFailed(QueryException.java:1598)
at org.eclipse.persistence.queries.DatabaseQuery.checkPrepare(DatabaseQuery.java:694)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.checkPrepare(ObjectLevelReadQuery.java:968)
at org.eclipse.persistence.queries.DatabaseQuery.checkPrepare(DatabaseQuery.java:624)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:881)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1191)
at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:485)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1279)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:3004)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1898)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1880)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1845)
at org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.java:262)
at org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.java:482)
... 35 more
Caused by: java.lang.NullPointerException
at org.eclipse.persistence.expressions.ExpressionOperator.printCollection(ExpressionOperator.java:2391)
at org.eclipse.persistence.internal.expressions.ArgumentListFunctionExpression.printSQL(ArgumentListFunctionExpression.java:102)
at org.eclipse.persistence.expressions.ExpressionOperator.printCollection(ExpressionOperator.java:2400)
at org.eclipse.persistence.internal.expressions.FunctionExpression.printSQL(FunctionExpression.java:581)
at org.eclipse.persistence.internal.expressions.SQLSelectStatement.appendOrderClauseToWriter(SQLSelectStatement.java:787)
at org.eclipse.persistence.internal.expressions.SQLSelectStatement.printSQLOrderByClause(SQLSelectStatement.java:1831)
at org.eclipse.persistence.internal.expressions.SQLSelectStatement.printSQL(SQLSelectStatement.java:1758)
at org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.printSQLSelectStatement(DatabasePlatform.java:3586)
at org.eclipse.persistence.platform.database.PostgreSQLPlatform.printSQLSelectStatement(PostgreSQLPlatform.java:543)
at org.eclipse.persistence.internal.expressions.SQLSelectStatement.buildCall(SQLSelectStatement.java:868)
at org.eclipse.persistence.internal.expressions.SQLSelectStatement.buildCall(SQLSelectStatement.java:879)
at org.eclipse.persistence.descriptors.ClassDescriptor.buildCallFromStatement(ClassDescriptor.java:885)
at org.eclipse.persistence.internal.queries.StatementQueryMechanism.setCallFromStatement(StatementQueryMechanism.java:393)
at org.eclipse.persistence.internal.queries.StatementQueryMechanism.prepareSelectAllRows(StatementQueryMechanism.java:318)
at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.prepareSelectAllRows(ExpressionQueryMechanism.java:1724)
at org.eclipse.persistence.queries.ReadAllQuery.prepareSelectAllRows(ReadAllQuery.java:910)
at org.eclipse.persistence.queries.ReadAllQuery.prepare(ReadAllQuery.java:841)
at org.eclipse.persistence.queries.DatabaseQuery.checkPrepare(DatabaseQuery.java:675)
... 47 more
Exception only occur under load so i am sure that issue is related to thread safety of argumentIndices variable in ExpressionOperator class.
I am attaching a sample which is build with helidon and I have three flavor of sql which all fail with same error. Sample can be run with both oracle or postgres by changing commented lines in
pom.xml
persistence.xml
application.yaml
This issue is very critical to us because without using coalesce or selectcase we can not achieve nulllast sorting using criteria. So, please suggest any workaround if possible.
thanks