XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Unresolved
    • Icon: High High
    • New Delhi Release
    • None
    • NCMP
    • None

      Description

      After recent CPS master commit (https://gerrit.onap.org/r/c/cps/+/137713), CmHandle registration started to fail due to module sync task failure, CmHandle getting stuck in LOCKED state:

      {
          "cmHandle": "497F02DE474EFFBAE54DBB05DAB05644",
          "publicCmHandleProperties": [
              {
                  "emsId": "2"
              }
          ],
          "state": {
              "cmHandleState": "LOCKED",
              "lockReason": {
                  "reason": "MODULE_SYNC_FAILED",
                  "details": "Upgrade to ModuleSetTag:  Attempt #2 failed: 200 OK from POST http://dmi-model-service:8080/dmi/v1/ch/497F02DE474EFFBAE54DBB05DAB05644/moduleResources"
              },
              "lastUpdateTime": "2024-04-25T10:50:12.910+0000"
          },
          "trustLevel": "COMPLETE",
          "moduleSetTag": "",
          "alternateId": "",
          "dataProducerIdentifier": ""
      } 

       

      After debugging the code, it turned out that DMI Model Service provides response to request on `/moduleResources` endpoint, and the exception is:

       

      Root cause of this error is that `/moduleResources`  endpoint on a production environment returns a body of size > 1MB, which exceeds the default size mentioned in the exception.

       

      The solution could be to make DmiWebClientConfiguration allow bigger limits and preferably make it configurable via application.yaml. 

      Highlighted code change below to DmiWebClientConfiguration class resolved the issue after rebuilding:

       

      @Bean
      public WebClient webClient() {
          final var httpClient = HttpClient.create()
                  .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, connectionTimeoutInSeconds * 1000)
                  .doOnConnected(connection ->
                          connection
                                  .addHandlerLast(new ReadTimeoutHandler(connectionTimeoutInSeconds, TimeUnit.SECONDS))
                                  .addHandlerLast(new WriteTimeoutHandler(connectionTimeoutInSeconds, TimeUnit.SECONDS)));    return WebClient.builder()
                  .defaultHeaders(header -> header.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE))
                  .defaultHeaders(header -> header.set(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE))
                  .clientConnector(new ReactorClientHttpConnector(httpClient))
                  .codecs(configurer -> configurer
                          .defaultCodecs()
                          .maxInMemorySize(16 * 1024 * 1024))
                  .build();
      }

       

      Affected version

      CPS master branch, since commit id `71bcac8b10e3298a8ed78e137540472c2f7f8e40`

       

      Reproduction

      Perform cmHandle creation with DMI Model Service providing large module resource response ( > ~260k)

       

      Expected behavior

      Module sync task successful for large moduleResources response.

       

      Workaround

      No workaround found, code change is possibly needed.

            sourabh_sourabh Sourabh Sourabh
            emolger Gergely Molnar
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: