Skip to content

[Bug] Producer was not clean up after closed #55

Closed

Description

@BewareMyPower

Search before asking

  • I searched in the issues and found nothing similar.

Version

  • OS: Ubuntu 20.04
  • Pulsar: 2.10.1
  • C++ client: master 7f7653b

Minimal reproduce step

#include <pulsar/Client.h>
#include <chrono>
#include <thread>
using namespace pulsar;

int main() {
    Client client("pulsar://localhost:6650");
    while (true) {
        Producer producer;
        auto result = client.createProducer("my-topic", producer);
        if (result != ResultOk) {
            break;
        }
        producer.close();
        std::this_thread::sleep_for(std::chrono::milliseconds(500));
    }
    client.close();
}

What did you expect to see?

The memory usage should be stable.

What did you see instead?

The program above just create producers in loop. However, the memory usage keeps increasing after some time (in my local env, after the 27th producer is created, each time a producer is created and closed, 16KB memory usage will be increased)

Here is a simple script to detect memory usage on Linux (assuming the program name is SampleProducer):

#!/bin/bash
set -ex
PROC_ID=$(ps aux | grep "SampleProducer" | grep -v grep | awk '{print $2}')
if [[ $PROC_ID ]]; then
    for i in {1..100}; do
        cat /proc/$PROC_ID/status | grep VmData
        sleep 1
    done
fi

20221019155148

Anything else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Activity

  1. BewareMyPower commented on Oct 19, 2022

    @BewareMyPower
    ContributorAuthor

    With patch from #54, the memory keeps stable (even if I sent a message in each iteration), see

    1

    2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions