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

http2 adaptor leaks qdr_connection_t and qdr_http2_connection_t objects when connector and server deleted at the same time #651

Closed
ganeshmurthy opened this issue Aug 3, 2022 · 0 comments · Fixed by #688
Assignees
Labels
bug Something isn't working
Milestone

Comments

@ganeshmurthy
Copy link
Contributor

A http2 server has a http2Connector to a server. When a management delete is run on the connector at the same time that the server is killed, the http2 adaptor leaks qdr_connection_t and qdr_http2_connection_t objects

The following reproducer is courtesy of @kgiusti . You will see the leaked connections number increasing slowly

class Http2AdaptorIssue627Test(TestCase):
    """
    Test connector delete via managment during server connection loss
    """
    CONNECTOR_TYPE = 'io.skupper.router.httpConnector'
    PROTOCOL_VERSION = "HTTP2"

    @classmethod
    def setUpClass(cls):
        super(Http2AdaptorIssue627Test, cls).setUpClass()

        cls.test_name = 'HTTPAdaptorIssue627'

        config = Qdrouterd.Config([('router', {'mode': 'interior',
                                               'id': 'INTA'}),
                                   ('listener', {'role': 'normal',
                                                 'port': cls.tester.get_port()}),
                                   ('address', {'prefix': 'closest',   'distribution': 'closest'}),
                                   ('address', {'prefix': 'multicast', 'distribution': 'multicast'}),
                                   ])
        cls.INTA = cls.tester.qdrouterd('INTA', config, wait=True)

    def start_server(self, connector_port):
        server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
        server.settimeout(TIMEOUT)
        server.bind(("", connector_port))
        server.listen(1)
        return server

    def test_01_issue_627(self):
        """Reproduce Issue #627"""
        mgmt = self.INTA.management

        for i in range(3000):
            connector_name = f"Connector_{self.test_name}_{i}"
            van_address = f"closest/{self.test_name}/{i}"
            connector_port = self.tester.get_port()


            cmd = ["test-receiver",
                   "-a", self.INTA.addresses[0],
                   "-c", "0"]
            rx = self.popen(cmd, expect=-15)

            cmd = ["test-sender",
                   "-a", self.INTA.addresses[0],
                   "-c", "0"]
            tx = self.popen(cmd, expect=-15)

            with self.start_server(connector_port) as server:
                attributes = {'address': van_address,
                              'host': '127.0.0.1',
                              'port': connector_port,
                              'protocolVersion': self.PROTOCOL_VERSION}
                mgmt.create(type=self.CONNECTOR_TYPE,
                            name=connector_name,
                            attributes=attributes)
                # server_conn, _ = server.accept()

                self.INTA.wait_address(van_address, subscribers=1)

                # server_conn.shutdown(socket.SHUT_RDWR)
                # server_conn.close()

            mgmt.delete(type=self.CONNECTOR_TYPE, name=connector_name)

            self.INTA.wait_address_unsubscribed(van_address, timeout=15.0)

            tx.terminate()
            tx.wait()
            tx.teardown()
            rx.terminate()
            rx.wait()
            rx.teardown()

            results = mgmt.query(type='io.skupper.router.connection').results
            print(f"Test cycle {i} complete {len(results)}!", flush=True)
@ganeshmurthy ganeshmurthy self-assigned this Aug 3, 2022
@ganeshmurthy ganeshmurthy added the bug Something isn't working label Aug 3, 2022
@ganeshmurthy ganeshmurthy added this to the 2.1.0 milestone Aug 3, 2022
ganeshmurthy added a commit to ganeshmurthy/skupper-router that referenced this issue Aug 4, 2022
…nnection_t object leaks by freeing them when a closed connection is being activated
ganeshmurthy added a commit to ganeshmurthy/skupper-router that referenced this issue Aug 18, 2022
…if the connector has been deleted and frees the associated connections
ganeshmurthy added a commit to ganeshmurthy/skupper-router that referenced this issue Aug 18, 2022
…if the connector has been deleted and frees the associated connections
ganeshmurthy added a commit to ganeshmurthy/skupper-router that referenced this issue Sep 7, 2022
…if the connector has been deleted and frees the associated connections
ganeshmurthy added a commit that referenced this issue Sep 7, 2022
…or has been deleted and frees the associated connections (#688)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant