Skip to content

Conversation

@stayallive
Copy link
Collaborator

@stayallive stayallive commented Jan 13, 2023

Fixes #632.

There is a downside with this "fix" (hence still a draft).

We might be leaking memory here since we never cleanup any breadcrumbs from failed queue jobs. When a queue workers is running this might be an issue where these breadcrumbs will never be visible but are kept in memory. So when a queue worker churns through say 500 jobs that threw exceptions it has 1500 breadcrumbs (3 per scope) and 500 scopes (unless we limit the amount of scopes already!?).

So not a 100% sure this is the way.

A fix for this can be where we pop the scope if we need to before we run a job, however that breaks this test where the middle breadcrumb from this test is being lost which is not ideal either.

@cleptric
Copy link
Member

Do we hold references for these scopes/breadcrumbs somewhere? If so, we could purge them after X accumulated.

@cleptric cleptric self-requested a review March 5, 2023 21:41
@stayallive
Copy link
Collaborator Author

To prevent issues with scopes / breadcrumbs pilling up we pop the scope (if we had pushed one) before starting a new job / scope. For the mostly happy paths in the tests this works correctly. This seems like an improvement but feel free to poke holes in my assumptions!

@stayallive stayallive marked this pull request as ready for review April 12, 2023 13:08
@stayallive stayallive merged commit 0a8f04a into master Apr 13, 2023
@stayallive stayallive deleted the feature/job-fixes branch April 13, 2023 08:35
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 this pull request may close these issues.

[Laravel Horizon] Breadcrumbs in Job handle function do not get recorded.

3 participants