Skip to content

Commit c3bf246

Browse files
authored
Update Exception Handling for ClusterTasks (#490)
1 parent d464672 commit c3bf246

File tree

5 files changed

+22
-14
lines changed

5 files changed

+22
-14
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ for more information.
2929

3030
* Enhance exception handling in `JSONClient` to capture messages returned as raw strings.
3131

32+
### 🐞 Bug Fixes
33+
34+
* Improve exception handling in admin client for sibling instances during startup.
35+
3236
## 33.2.0 - 2025-11-10
3337

3438
### 🎁 New Features

grails-app/controllers/io/xh/hoist/admin/ClientAdminController.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ClientAdminController extends BaseController {
2222
def allClients() {
2323
// Need to serialize the complex WebSocketsSessions as JSON -- parse and rejoin here
2424
def ret = runOnAllInstancesAsJson(webSocketService.&getAllChannels)
25-
.collectMany { it.value.value ? parseArray(it.value.value) : null}
25+
.collectMany { it.value.exception ? [] : parseArray(it.value.value)}
2626
renderJSON(ret)
2727
}
2828

grails-app/services/io/xh/hoist/admin/ClusterObjectsService.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class ClusterObjectsService extends BaseService {
3232
ClusterObjectsReport getClusterObjectsReport() {
3333
def startTimestamp = currentTimeMillis(),
3434
info = runOnAllInstancesAsJson(this.&listClusterObjects)
35-
.collectMany { parseArray(it.value.value) }
35+
.collectMany { it.value.exception ? [] : parseArray(it.value.value) }
3636

3737
return new ClusterObjectsReport(info, startTimestamp, currentTimeMillis())
3838
}

grails-app/services/io/xh/hoist/cluster/ClusterAdminService.groovy

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,11 @@ class ClusterAdminService extends BaseService {
3131
Collection<Map> getAllStats() {
3232
runOnAllInstances(this.&getAdminStats)
3333
.collect { name, result ->
34-
def ret = [
34+
[
3535
name : name,
36-
isReady: false
36+
isReady: false,
37+
*:(result.value ?: [:])
3738
]
38-
if (result.value) {
39-
ret << result.value
40-
} else {
41-
Utils.handleException(
42-
exception: result.exception,
43-
logTo: this,
44-
logMessage: "Exception getting stats for $name"
45-
)
46-
}
47-
return ret
4839
}
4940
}
5041

grails-app/services/io/xh/hoist/cluster/ClusterService.groovy

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,14 @@ class ClusterService extends BaseService implements ApplicationListener<Applicat
203203
taskExecutor.submitToMember(clusterRequest, getMember(instance)).get()
204204
} catch (Throwable t) {
205205
// task catches issue on instance. Catch deeper hz issue here
206+
Utils.handleException(
207+
exception: t,
208+
logTo: this,
209+
logMessage: [
210+
'Error transferring task result',
211+
[sourceInstance: instance, svc: c.svc, method: c.method]
212+
]
213+
)
206214
return new ClusterResult(exception: new ClusterTaskException(t))
207215
}
208216
}
@@ -220,6 +228,11 @@ class ClusterService extends BaseService implements ApplicationListener<Applicat
220228
return [name, f.get()]
221229
} catch (Throwable t) {
222230
// task catches issue on instance. Catch deeper hz issue here
231+
Utils.handleException(
232+
exception: t,
233+
logTo: this,
234+
logMessage: ['Error transferring task result', [sourceInstance: name, svc: c.svc, method: c.method]]
235+
)
223236
return [name, new ClusterResult(exception: new ClusterTaskException(t))]
224237
}
225238
}

0 commit comments

Comments
 (0)