Coder Social home page Coder Social logo

Job recorder memory leak about telescope HOT 9 CLOSED

nick-potts avatar nick-potts commented on June 2, 2024 3
Job recorder memory leak

from telescope.

Comments (9)

driesvints avatar driesvints commented on June 2, 2024 1

Gonna close this since you found a solution. Thanks

from telescope.

github-actions avatar github-actions commented on June 2, 2024

Thank you for reporting this issue!

As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.

If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.

Thank you!

from telescope.

nick-potts avatar nick-potts commented on June 2, 2024
for ($i = 0; $i < 5000; $i++) {
   Telescope::recordJob(new IncomingEntry(['hi' => str_repeat('a', 100000)], Str::uuid()));
}

Given this fails, I think this is more a problem with the fact telescope will store unlimited amounts of entries before running store. In my case, I often have to queue 20k jobs in local development. The job dispatching often runs out of memory around 10k jobs.

Would a max queue length make sense for telescope?

from telescope.

nick-potts avatar nick-potts commented on June 2, 2024

I have solved it myself via :

    Telescope::$afterRecordingHook = function () {
            if (count(Telescope::$entriesQueue) > 1000) {
                Telescope::store(app(EntriesRepository::class));
            }
        };

It does seem like a bit of a footgun that wouldn't hurt to have some rails on it. Don't mind writing the pull request if you want a max queue size variable.

from telescope.

beliven-daniele-sarnari avatar beliven-daniele-sarnari commented on June 2, 2024

This should be implemented by a config @nick-potts

from telescope.

alekseyp avatar alekseyp commented on June 2, 2024

What solution? Disable job watcher?
C'mon...

from telescope.

driesvints avatar driesvints commented on June 2, 2024

I don't think the above scenario is a realistic one for a real-world application sorry. Dispatching 5000 jobs in a row most likely is better refactored to a different way where you can spread out the dispatching over multiple requests. We're still open to PR's to improve this.

from telescope.

alekseyp avatar alekseyp commented on June 2, 2024

We dispatch way less jobs and our app still goes OOM when telescope is attached.
I don't think this issue should have been closed since it's a massive headache. And if you google it a you will see how many people struggle with it.

I don't see why should we change how many jobs one command (not request) creates

from telescope.

nick-potts avatar nick-potts commented on June 2, 2024

Another, more real-world, scenario where php can crash due to running out of memory is the query watcher.

If you run many queries in the same request/job, it'll never flush and can run through the available memory quite quickly.

I can potentially write a PR, just not sure how best to implement it.

from telescope.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.