Skip to content

Commit 1655ae2

Browse files
manaswini1920Manaswini Ragamouni
andauthored
Fix listener leak in TransportExecuteMonitorAction for empty source (#2080)
Add else block when getResponse.isSourceEmpty is true to call actionListener.onFailure() instead of silently dropping the request. Without this, the listener is never notified and the thread hangs. Signed-off-by: Manaswini Ragamouni <ragamanu@amazon.com> Co-authored-by: Manaswini Ragamouni <ragamanu@amazon.com>
1 parent b7dcd09 commit 1655ae2

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportExecuteMonitorAction.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,15 @@ class TransportExecuteMonitorAction @Inject constructor(
135135
val monitor = ScheduledJob.parse(xcp, getResponse.id, getResponse.version) as Monitor
136136
executeMonitor(monitor)
137137
}
138+
} else {
139+
actionListener.onFailure(
140+
AlertingException.wrap(
141+
OpenSearchStatusException(
142+
"Monitor source is empty for id: ${execMonitorRequest.monitorId}",
143+
RestStatus.NOT_FOUND
144+
)
145+
)
146+
)
138147
}
139148
} catch (e: Exception) {
140149
log.error("Failed to get monitor ${execMonitorRequest.monitorId} for execution", e)

0 commit comments

Comments
 (0)