Skip to content

[Logging] Memory leak in the LoggingClient with grpc #450

@tmatsuo

Description

@tmatsuo

Steps to repro:

$ composer require google/cloud-logging google/gax google/proto-client-php

logging-test.php

<?php

require_once __DIR__ . '/vendor/autoload.php';

use Google\Cloud\Logging\LoggingClient;

$c = new LoggingClient();

$logger = $c->logger('test-log');

$entries = [];
# Create 1000 batch of entries                                                                                                                                     
for ($i = 0; $i < 1000; $i++) {
    $entries[] =  $logger->entry('test message');
}

while (true)
{
    $logger->writeBatch($entries);
    # Just in case                                                                                                                                                 
    gc_collect_cycles();
    printf(
        'memory used: %d' . PHP_EOL, memory_get_usage()
    );
}

Set GOOGLE_APPLICATION_CREDENTIALS and run it with and without grpc extension.

With the rest, the memory usage stays the same, but with grpc, it goes up.

$ php logging-test.php                                                                                                        
memory used: 3651568
memory used: 3662568
memory used: 3673536
memory used: 3684504
memory used: 3695472
memory used: 3706440
...
...

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.api: loggingIssues related to the Cloud Logging API.gapictriage meI really want to be triaged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions