diff options
author | Jozsef Csongvai <jozsef.csongvai@bell.ca> | 2022-04-12 20:25:18 -0400 |
---|---|---|
committer | Jozsef Csongvai <jozsef.csongvai@bell.ca> | 2022-04-12 22:41:20 -0400 |
commit | f5329877c16a910338274240d8e5e80ad7a28573 (patch) | |
tree | 426f156fb3933298f8dd571cb0caf1c68233ae65 /ms/blueprintsprocessor/modules/inbounds/selfservice-api/src | |
parent | 2264544baa8d38930d60524c806cd32c1e7ac045 (diff) |
Prevent stack overflow in BluePrintProcessingGRPCHandler
The overridden onError is called when a terminating error occurs in
the stream, for example when the calling client crashes. It should not
be handled the same way as CBA processing errors.
Issue-ID: CCSDK-3496
Signed-off-by: Jozsef Csongvai <jozsef.csongvai@bell.ca>
Change-Id: Ib0aa416325a5b9708615e0ef9d9c602df24518b9
Diffstat (limited to 'ms/blueprintsprocessor/modules/inbounds/selfservice-api/src')
-rw-r--r-- | ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt index 79106c24a..a2101856a 100644 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt @@ -61,18 +61,17 @@ open class BluePrintProcessingGRPCHandler( executionServiceHandler.process(executionServiceInput.toJava(), responseObserver) } } catch (e: Exception) { - onError(e) + if (e is BluePrintProcessorException) handleWithErrorCatalog(e) else handleError(e) } finally { ph.arriveAndDeregister() } } override fun onError(error: Throwable) { - log.debug("Fail to process message", error) - if (error is BluePrintProcessorException) onErrorCatalog(error) else onError(error) + log.error("Terminating stream error:", error) } - fun onError(error: Exception) { + fun handleError(error: Exception) { responseObserver.onError( Status.INTERNAL .withDescription(error.errorMessageOrDefault()) @@ -81,7 +80,7 @@ open class BluePrintProcessingGRPCHandler( ) } - fun onErrorCatalog(error: BluePrintProcessorException) { + fun handleWithErrorCatalog(error: BluePrintProcessorException) { if (error.protocol == "") { error.grpc(ErrorCatalogCodes.GENERIC_FAILURE) } |