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

Exponential memory usage growth with stacked data and Request collector #665

Open
dotdash opened this issue Aug 18, 2024 · 2 comments · May be fixed by #666
Open

Exponential memory usage growth with stacked data and Request collector #665

dotdash opened this issue Aug 18, 2024 · 2 comments · May be fixed by #666

Comments

@dotdash
Copy link

dotdash commented Aug 18, 2024

The request data collector store the data from $_SESSION which contains the stacked data, which in turn contains the data from the request collector, etc, so memory usage double with each request. So with multiple requests that have a request data collector and getting stacked, that becomes a problem rather quickly.

@dotdash
Copy link
Author

dotdash commented Aug 18, 2024

FWIW, I have created a derived class locally, that simply drops the stacked data from the session whenever collecting data:

    /**
     * @return mixed[]
     */
    public function collect(): array
    {
        $http = $this->initStackSession();

        // Avoid quadratic memory usage growth by removing any stacked data
        // from the session, as the stacked data may also contains the session
        $stack = $http->getSessionValue($this->stackSessionNamespace);
        $http->deleteSessionValue($this->stackSessionNamespace);

        $data = parent::collect();

        $stack = $http->setSessionValue($this->stackSessionNamespace, $stack);

        return $data;
    }

@parallels999
Copy link
Contributor

Open a pull request 👍

@dotdash dotdash changed the title Quadratic memory usage growth with stacked data and Request collector Exponential memory usage growth with stacked data and Request collector Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants