From f5329877c16a910338274240d8e5e80ad7a28573 Mon Sep 17 00:00:00 2001 From: Jozsef Csongvai Date: Tue, 12 Apr 2022 20:25:18 -0400 Subject: 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 Change-Id: Ib0aa416325a5b9708615e0ef9d9c602df24518b9 --- .../selfservice/api/BluePrintProcessingGRPCHandler.kt | 9 ++++----- 1 file 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) } -- cgit 1.2.3-korg