Skip to content

Memory leak when using persistent connections #514

Closed
@mmoreram

Description

@mmoreram

When using persistent connections, this code makes me think that could cause problems... This happens inside the handleRequest in StreamingServer file. If we use persistent connections, we are adding one close event per request, causing all responses being referenced, even when it is returned properly (not allowing GC make its work).

// cancel pending promise once connection closes
if ($response instanceof PromiseInterface && \method_exists($response, 'cancel')) {
    $conn->on('close', function () use ($response) {
        $response->cancel();
    });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions