mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
The reason for this is that as part of DefaultOrmQuery.copy() it uses DefaultExpressionList.copy() and that assumed that expressions were safe to share which is NOT the case for IN and EXISTS sub-query expressions so InQueryExpression and ExistsQueryExpression The effective fix for this is that DefaultExpressionList.copy() changes to call SpiExpression.copy() and for InQueryExpression and ExistsQueryExpression to implement that copy() by creating a copy of the sub-query. A "side-fix" is that in DefaultOrmQuery.createExtraJoinsToSupportManyWhereClause() it was creating an instance of ManyWhereJoins, then mutating it ... and if we change that to only doing the assignment at the end (object assignment is atomic) then racy access reading ManyWhereJoins would always get a fully completed non-mutating instance of ManyWhereJoins. Noting this because it kind of points to where I think the race condition is (in createExtraJoinsToSupportManyWhereClause()) but noting that with the change to DefaultExpressionList.copy() this "side-fix" isn't required per say.