ballerina-platform / ballerina-library

The Ballerina Library
https://ballerina.io/learn/api-docs/ballerina/
Apache License 2.0
136 stars 64 forks source link

Getting cyclic reference for a simple json with `datajson:toJson` method #7362

Closed TharmiganK closed 1 week ago

TharmiganK commented 1 week ago

Description

$Subject

This is happening after this fix: https://github.com/ballerina-platform/module-ballerina-data.jsondata/pull/51

Steps to Reproduce

Try to run the following command in http after updating stdlibDataJsonDataVersion=0.3.0-20241113-131800-94297e4 in the gradle.properties file.

$ ./gradlew clean build -x :http-native:test -PbalTests=http2-tests

...

Running Tests with Coverage

        http2_tests
Couldn't complete the respond operation as the response has been already used.
error: the value has a cyclic reference
        at ballerina.data.jsondata.0:toJson(json_api.bal:58)
           ballerina.http.2.Request:setJsonPayload(http_request.bal:426)
           ballerina.http.2.Request:setPayload(http_request.bal:560)
           ballerina.http2_tests$test.2.$anonType$_190:$get$initial(tests/http2_client_upgrade_with_large_payload_test.bal:134)

        testClientUpgradewithLargePayload: has failed.

error: there are test failures

This is happening in this step: https://github.com/ballerina-platform/module-ballerina-http/blob/3feb04b51a86377cb78b0f8a9a8cc296ef4e5957/ballerina-tests/http2-tests/tests/http2_client_upgrade_with_large_payload_test.bal#L134 where we call setPayload with a raw json value. This function internally call the jsondata:toJson method

Version

Ballerina SwanLake Update 11

Environment Details (with versions)

Mac OS

github-actions[bot] commented 1 week ago

This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now.

      - Reason/EngineeringMistake - The issue occurred due to a mistake made in the past.
      - Reason/Regression - The issue has introduced a regression.
      - Reason/MultipleComponentInteraction - Issue occured due to interactions in multiple components.
      - Reason/Complex - Issue occurred due to complex scenario.
      - Reason/Invalid - Issue is invalid.
      - Reason/Other - None of the above cases.