Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[swig]: Fix swig template memory leak on issue 17025 #878

Merged
merged 2 commits into from
Jun 3, 2024

Merge branch '202311' into 202311_memory_leak

61afb78
Select commit
Loading
Failed to load commit list.
Merged

[swig]: Fix swig template memory leak on issue 17025 #878

Merge branch '202311' into 202311_memory_leak
61afb78
Select commit
Loading
Failed to load commit list.
Azure Pipelines / Azure.sonic-swss-common succeeded May 31, 2024 in 4h 16m 34s

Build #20240530.8 had test failures

Details

Tests

  • Failed: 5 (0.33%)
  • Passed: 1,425 (93.38%)
  • Other: 96 (6.29%)
  • Total: 1,526
Code coverage

  • 3985 of 6752 branches covered (59.02%)
  • 4616 of 5682 lines covered (81.24%)

Annotations

Check failure on line 1 in test_dscp_to_fc

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Azure.sonic-swss-common

test_dscp_to_fc

AssertionError: Unexpected number of keys: expected=8, received=7 (('oid:0x1400000000060e', 'oid:0x14000000000616', 'oid:0x14000000000611', 'oid:0x14000000000615', 'oid:0x14000000000612', 'oid:0x1400000000060d', 'oid:0x14000000000614')), table="ASIC_STATE:SAI_OBJECT_TYPE_QOS_MAP"
Raw output
self = <test_qos_map.TestCbf object at 0x7f24c4969730>
dvs = <conftest.DockerVirtualSwitch object at 0x7f24c4b0a910>

    def test_dscp_to_fc(self, dvs):
        self.init_test(dvs)
    
        # Create a DSCP_TO_FC map
        dscp_map = [(str(i), str(i)) for i in range(0, 63)]
        self.dscp_ps.set("AZURE", swsscommon.FieldValuePairs(dscp_map))
    
>       self.asic_db.wait_for_n_keys(self.ASIC_QOS_MAP_STR, self.asic_qos_map_count + 1)

test_qos_map.py:328: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <dvslib.dvs_database.DVSDatabase object at 0x7f24c4ae44f0>
table_name = 'ASIC_STATE:SAI_OBJECT_TYPE_QOS_MAP', num_keys = 8
wait_at_least_n_keys = False
polling_config = PollingConfig(polling_interval=0.01, timeout=20.0, strict=True)
failure_message = None

    def wait_for_n_keys(
        self,
        table_name: str,
        num_keys: int,
        wait_at_least_n_keys: bool = False,
        polling_config: PollingConfig = PollingConfig(),
        failure_message: str = None,
    ) -> List[str]:
        """Wait for the specified number of keys to exist in the table.
    
        Args:
            table_name: The name of the table from which to fetch the keys.
            num_keys: The expected number of keys to retrieve from the table.
            polling_config: The parameters to use to poll the db.
            failure_message: The message to print if the call times out. This will only take effect
                if the PollingConfig is set to strict.
    
        Returns:
            The keys stored in the table. If no keys are found, then an empty List is returned.
        """
    
        def access_function():
            keys = self.get_keys(table_name)
            if wait_at_least_n_keys:
                return (len(keys) >= num_keys, keys)
            else:
                return (len(keys) == num_keys, keys)
    
        status, result = wait_for_result(
            access_function, self._disable_strict_polling(polling_config)
        )
    
        if not status:
            message = failure_message or (
                f"Unexpected number of keys: expected={num_keys}, received={len(result)} "
                f'({result}), table="{table_name}"'
            )
>           assert not polling_config.strict, message
E           AssertionError: Unexpected number of keys: expected=8, received=7 (('oid:0x1400000000060e', 'oid:0x14000000000616', 'oid:0x14000000000611', 'oid:0x14000000000615', 'oid:0x14000000000612', 'oid:0x1400000000060d', 'oid:0x14000000000614')), table="ASIC_STATE:SAI_OBJECT_TYPE_QOS_MAP"

dvslib/dvs_database.py:402: AssertionError

Check failure on line 1 in test_exp_to_fc

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Azure.sonic-swss-common

test_exp_to_fc

AssertionError: Unexpected number of keys: expected=8, received=7 (('oid:0x1400000000060e', 'oid:0x14000000000616', 'oid:0x14000000000611', 'oid:0x14000000000615', 'oid:0x14000000000612', 'oid:0x1400000000060d', 'oid:0x14000000000614')), table="ASIC_STATE:SAI_OBJECT_TYPE_QOS_MAP"
Raw output
self = <test_qos_map.TestCbf object at 0x7f24c4c9e1f0>
dvs = <conftest.DockerVirtualSwitch object at 0x7f24c4b0a910>

    def test_exp_to_fc(self, dvs):
        self.init_test(dvs)
    
        # Create a EXP_TO_FC map
        exp_map = [(str(i), str(i)) for i in range(0, 8)]
        self.exp_ps.set("AZURE", swsscommon.FieldValuePairs(exp_map))
    
>       self.asic_db.wait_for_n_keys(self.ASIC_QOS_MAP_STR, self.asic_qos_map_count + 1)

test_qos_map.py:383: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <dvslib.dvs_database.DVSDatabase object at 0x7f24c4ae44f0>
table_name = 'ASIC_STATE:SAI_OBJECT_TYPE_QOS_MAP', num_keys = 8
wait_at_least_n_keys = False
polling_config = PollingConfig(polling_interval=0.01, timeout=20.0, strict=True)
failure_message = None

    def wait_for_n_keys(
        self,
        table_name: str,
        num_keys: int,
        wait_at_least_n_keys: bool = False,
        polling_config: PollingConfig = PollingConfig(),
        failure_message: str = None,
    ) -> List[str]:
        """Wait for the specified number of keys to exist in the table.
    
        Args:
            table_name: The name of the table from which to fetch the keys.
            num_keys: The expected number of keys to retrieve from the table.
            polling_config: The parameters to use to poll the db.
            failure_message: The message to print if the call times out. This will only take effect
                if the PollingConfig is set to strict.
    
        Returns:
            The keys stored in the table. If no keys are found, then an empty List is returned.
        """
    
        def access_function():
            keys = self.get_keys(table_name)
            if wait_at_least_n_keys:
                return (len(keys) >= num_keys, keys)
            else:
                return (len(keys) == num_keys, keys)
    
        status, result = wait_for_result(
            access_function, self._disable_strict_polling(polling_config)
        )
    
        if not status:
            message = failure_message or (
                f"Unexpected number of keys: expected={num_keys}, received={len(result)} "
                f'({result}), table="{table_name}"'
            )
>           assert not polling_config.strict, message
E           AssertionError: Unexpected number of keys: expected=8, received=7 (('oid:0x1400000000060e', 'oid:0x14000000000616', 'oid:0x14000000000611', 'oid:0x14000000000615', 'oid:0x14000000000612', 'oid:0x1400000000060d', 'oid:0x14000000000614')), table="ASIC_STATE:SAI_OBJECT_TYPE_QOS_MAP"

dvslib/dvs_database.py:402: AssertionError

Check failure on line 1 in test_per_port_cbf_binding

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Azure.sonic-swss-common

test_per_port_cbf_binding

AssertionError: Unexpected number of keys: expected=8, received=7 (('oid:0x1400000000060e', 'oid:0x14000000000616', 'oid:0x14000000000611', 'oid:0x14000000000615', 'oid:0x14000000000612', 'oid:0x1400000000060d', 'oid:0x14000000000614')), table="ASIC_STATE:SAI_OBJECT_TYPE_QOS_MAP"
Raw output
self = <test_qos_map.TestCbf object at 0x7f24c4b0dd60>
dvs = <conftest.DockerVirtualSwitch object at 0x7f24c4b0a910>

    def test_per_port_cbf_binding(self, dvs):
        self.init_test(dvs)
    
        # Create a DSCP_TO_FC map
        dscp_map = [(str(i), str(i)) for i in range(0, 63)]
        self.dscp_ps.set("AZURE", swsscommon.FieldValuePairs(dscp_map))
>       self.asic_db.wait_for_n_keys(self.ASIC_QOS_MAP_STR, self.asic_qos_map_count + 1)

test_qos_map.py:446: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <dvslib.dvs_database.DVSDatabase object at 0x7f24c4ae44f0>
table_name = 'ASIC_STATE:SAI_OBJECT_TYPE_QOS_MAP', num_keys = 8
wait_at_least_n_keys = False
polling_config = PollingConfig(polling_interval=0.01, timeout=20.0, strict=True)
failure_message = None

    def wait_for_n_keys(
        self,
        table_name: str,
        num_keys: int,
        wait_at_least_n_keys: bool = False,
        polling_config: PollingConfig = PollingConfig(),
        failure_message: str = None,
    ) -> List[str]:
        """Wait for the specified number of keys to exist in the table.
    
        Args:
            table_name: The name of the table from which to fetch the keys.
            num_keys: The expected number of keys to retrieve from the table.
            polling_config: The parameters to use to poll the db.
            failure_message: The message to print if the call times out. This will only take effect
                if the PollingConfig is set to strict.
    
        Returns:
            The keys stored in the table. If no keys are found, then an empty List is returned.
        """
    
        def access_function():
            keys = self.get_keys(table_name)
            if wait_at_least_n_keys:
                return (len(keys) >= num_keys, keys)
            else:
                return (len(keys) == num_keys, keys)
    
        status, result = wait_for_result(
            access_function, self._disable_strict_polling(polling_config)
        )
    
        if not status:
            message = failure_message or (
                f"Unexpected number of keys: expected={num_keys}, received={len(result)} "
                f'({result}), table="{table_name}"'
            )
>           assert not polling_config.strict, message
E           AssertionError: Unexpected number of keys: expected=8, received=7 (('oid:0x1400000000060e', 'oid:0x14000000000616', 'oid:0x14000000000611', 'oid:0x14000000000615', 'oid:0x14000000000612', 'oid:0x1400000000060d', 'oid:0x14000000000614')), table="ASIC_STATE:SAI_OBJECT_TYPE_QOS_MAP"

dvslib/dvs_database.py:402: AssertionError

Check failure on line 1 in test_sub_port_intf_nhg_accel

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Azure.sonic-swss-common

test_sub_port_intf_nhg_accel

AssertionError: Expected field/value pairs not found: expected={'SAI_NEXT_HOP_GROUP_MEMBER_ATTR_NEXT_HOP_GROUP_ID': 'oid:0x50000000007f3'}, received={'SAI_NEXT_HOP_GROUP_MEMBER_ATTR_NEXT_HOP_GROUP_ID': 'oid:0x50000000007fe', 'SAI_NEXT_HOP_GROUP_MEMBER_ATTR_NEXT_HOP_ID': 'oid:0x40000000007fd'}, key="oid:0x2d000000000801", table="ASIC_STATE:SAI_OBJECT_TYPE_NEXT_HOP_GROUP_MEMBER"
Raw output
self = <test_sub_port_intf.TestSubPortIntf object at 0x7f24c4704790>
dvs = <conftest.DockerVirtualSwitch object at 0x7f24c4b0a910>

    def test_sub_port_intf_nhg_accel(self, dvs):
        self.connect_dbs(dvs)
    
>       self._test_sub_port_intf_nhg_accel(dvs, self.SUB_PORT_INTERFACE_UNDER_TEST)

test_sub_port_intf.py:1465: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
test_sub_port_intf.py:1418: in _test_sub_port_intf_nhg_accel
    self.check_sub_port_intf_fvs(self.asic_db, ASIC_NEXT_HOP_GROUP_MEMBER_TABLE, nhg_member_oid, fv_dict)
test_sub_port_intf.py:427: in check_sub_port_intf_fvs
    db.wait_for_field_match(table_name, key, fv_dict)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <dvslib.dvs_database.DVSDatabase object at 0x7f24c4c3b790>
table_name = 'ASIC_STATE:SAI_OBJECT_TYPE_NEXT_HOP_GROUP_MEMBER'
key = 'oid:0x2d000000000801'
expected_fields = {'SAI_NEXT_HOP_GROUP_MEMBER_ATTR_NEXT_HOP_GROUP_ID': 'oid:0x50000000007f3'}
polling_config = PollingConfig(polling_interval=0.01, timeout=20.0, strict=True)
failure_message = None

    def wait_for_field_match(
        self,
        table_name: str,
        key: str,
        expected_fields: Dict[str, str],
        polling_config: PollingConfig = PollingConfig(),
        failure_message: str = None,
    ) -> Dict[str, str]:
        """Wait for the entry stored at `key` to have the specified field/values and retrieve it.
    
        This method is useful if you only care about the contents of a subset of the fields stored
        in the specified entry.
    
        Args:
            table_name: The name of the table where the entry is stored.
            key: The key that maps to the entry being checked.
            expected_fields: The fields and their values we expect to see in the entry.
            polling_config: The parameters to use to poll the db.
            failure_message: The message to print if the call times out. This will only take effect
                if the PollingConfig is set to strict.
    
        Returns:
            The entry stored at `key`. If no entry is found, then an empty Dict is returned.
        """
    
        def access_function():
            fv_pairs = self.get_entry(table_name, key)
            return (
                all(fv_pairs.get(k) == v for k, v in expected_fields.items()),
                fv_pairs,
            )
    
        status, result = wait_for_result(
            access_function, self._disable_strict_polling(polling_config)
        )
    
        if not status:
            message = failure_message or (
                f"Expected field/value pairs not found: expected={expected_fields}, "
                f'received={result}, key="{key}", table="{table_name}"'
            )
>           assert not polling_config.strict, message
E           AssertionError: Expected field/value pairs not found: expected={'SAI_NEXT_HOP_GROUP_MEMBER_ATTR_NEXT_HOP_GROUP_ID': 'oid:0x50000000007f3'}, received={'SAI_NEXT_HOP_GROUP_MEMBER_ATTR_NEXT_HOP_GROUP_ID': 'oid:0x50000000007fe', 'SAI_NEXT_HOP_GROUP_MEMBER_ATTR_NEXT_HOP_ID': 'oid:0x40000000007fd'}, key="oid:0x2d000000000801", table="ASIC_STATE:SAI_OBJECT_TYPE_NEXT_HOP_GROUP_MEMBER"

dvslib/dvs_database.py:239: AssertionError