599166320 opened a new issue, #14514:
URL: https://github.com/apache/druid/issues/14514
I executed a query similar to the one below in Grafana, which caused the CPU
to spike to 100%:
```
WITH ta as(
select distinct uri from t_a where xx='xx'
)
select time_floor(__time, 'PT1H'),count(*) from t_b left join ta on ta.uri
= t_b.uri group by 1
```
When I executed this SQL, I already added timeout=120000 in the context, but
it had no effect. It has been running on the historical server for more than 10
hours and still hasn't terminated.
Here is the call stack:
```
"timeseries_JoinDataSource{left=t_a,
right=InlineDataSource{signature={d0:STRING, a0:LONG, a1:LONG}},
rightPrefix='j0.', condition=("uri" == "j0.d0"), joinType=LEFT,
leftFilter=null}_[2023-06-29T14:00:00.000Z/2023-06-29T15:00:00.000Z]" #199
daemon prio=5 os_prio=0 cpu=3626786.80ms elapsed=2666537.92s
tid=0x0000fff45c007800 nid=0x4208 runnable [0x0000fff34c9b7000]
java.lang.Thread.State: RUNNABLE
at java.lang.String.<init>([email protected]/String.java:467)
at java.lang.String.<init>([email protected]/String.java:537)
at
org.apache.druid.java.util.common.StringUtils.fromUtf8(StringUtils.java:83)
at
org.apache.druid.java.util.common.StringUtils.fromUtf8(StringUtils.java:99)
at
org.apache.druid.segment.data.GenericIndexed$2.fromByteBuffer(GenericIndexed.java:153)
at
org.apache.druid.segment.data.GenericIndexed$2.fromByteBuffer(GenericIndexed.java:143)
at
org.apache.druid.segment.data.GenericIndexed$BufferIndexed.get(GenericIndexed.java:483)
at
org.apache.druid.segment.data.CachingIndexed.get(CachingIndexed.java:81)
at
org.apache.druid.segment.column.StringDictionaryEncodedColumn.lookupName(StringDictionaryEncodedColumn.java:105)
at
org.apache.druid.segment.column.StringDictionaryEncodedColumn$1QueryableDimensionSelector.lookupName(StringDictionaryEncodedColumn.java:166)
at
org.apache.druid.segment.virtual.ExpressionSelectors.lambda$supplierFromDimensionSelector$1(ExpressionSelectors.java:457)
at
org.apache.druid.segment.virtual.ExpressionSelectors$$Lambda$789/0x0000000800b6c440.get(Unknown
Source)
at
org.apache.druid.math.expr.InputBindings$6.get(InputBindings.java:145)
at
org.apache.druid.math.expr.IdentifierExpr.eval(IdentifierExpr.java:130)
at
org.apache.druid.math.expr.BinaryBooleanOpExprBase.eval(BinaryOperatorExpr.java:180)
at
org.apache.druid.segment.virtual.ExpressionColumnValueSelector.eval(ExpressionColumnValueSelector.java:54)
at
org.apache.druid.segment.virtual.BaseExpressionColumnValueSelector.computeCurrentEval(BaseExpressionColumnValueSelector.java:108)
at
org.apache.druid.segment.virtual.BaseExpressionColumnValueSelector.getObject(BaseExpressionColumnValueSelector.java:77)
at
org.apache.druid.segment.virtual.BaseExpressionColumnValueSelector.getObject(BaseExpressionColumnValueSelector.java:32)
at
org.apache.druid.segment.filter.ExpressionFilter$1.matches(ExpressionFilter.java:139)
at
org.apache.druid.segment.join.PostJoinCursor.advanceToMatch(PostJoinCursor.java:71)
at
org.apache.druid.segment.join.PostJoinCursor.advanceUninterruptibly(PostJoinCursor.java:100)
at
org.apache.druid.segment.join.PostJoinCursor.advance(PostJoinCursor.java:92)
at
org.apache.druid.query.timeseries.TimeseriesQueryEngine.lambda$processNonVectorized$3(TimeseriesQueryEngine.java:291)
at
org.apache.druid.query.timeseries.TimeseriesQueryEngine$$Lambda$704/0x0000000800b29c40.apply(Unknown
Source)
```
I feel that adding the following code at an appropriate location in the
classes HashJoinEngine and PostJoinCursor could fix this issue, but I'm unsure
about potential problems. There might be a better way to handle this.
```
if (hasTimeout && System.currentTimeMillis() >= timeoutAt) {
throw new QueryTimeoutException(StringUtils.nonStrictFormat("Query [%s]
timed out", query.getId()));
}
```
### Affected Version
24.0.1
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]