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

Disable example_status_persistence_file_path #227

Closed
technicalpickles opened this issue Oct 20, 2023 · 3 comments
Closed

Disable example_status_persistence_file_path #227

technicalpickles opened this issue Oct 20, 2023 · 3 comments
Labels

Comments

@technicalpickles
Copy link
Contributor

Mentioned this on #226 (comment)

I did find another benefit to doing this. If you have config.example_status_persistence_file_path set, you end up loading and dumping the status for all specs each time.

We ended up disabling this during CI. I could see it being a knapsack pro default if there is a good place to set it.

Documentation about this feature:

The file path to use for persisting example statuses. Necessary for the --only-failures and --next-failure CLI options.

I came across this while investigating #200 , and I saw a lot of memory allocations from the code that generates and publishes this file. Since knapsack wouldn't be using --on-failures or --next-failure, it should be safe to disable these.

@ArturT ArturT added the RSpec label Oct 20, 2023
@ArturT
Copy link
Member

ArturT commented Oct 20, 2023

What do you mean by disabling example_status_persistence_file_path? Is it about getting rid of some internal RSpec code that is responsible for handling that?

If a user does not set example_status_persistence_file_path in their spec_helper.rb, does it mean RSpec is still consuming a lot of memory?

We have some customers using --only-failures option to retry flaky tests. This is documented here.
This means they need to set example_status_persistence_file_path.

@technicalpickles
Copy link
Contributor Author

I mean not setting config.example_status_persistence_file_path, or setting it to falsey

If a user does not set example_status_persistence_file_path in their spec_helper.rb, does it mean RSpec is still consuming a lot of memory?

The code path that allocates a lot of memory doesn't get used. Specifically, it's the persister and loader in https://github.com/rspec/rspec-core/blob/1c662c35f91f33946fdfbed431878f4798f06f70/lib/rspec/core/example_status_persister.rb .

We have some customers using --only-failures option to retry flaky tests. This is documented here.
This means they need to set example_status_persistence_file_path.

Ah, in that case, this wouldn't work for them. Given that, I don't think it's worth adding complexity code-wise or documentation-wise to specify it. I think we can leave it as is then, and let users identify and disable themselves. Or #226 lands and it's mitigated because it's only persisted/loaded once

@ArturT
Copy link
Member

ArturT commented Oct 23, 2023

Ok. So no action for now.

By default config.example_status_persistence_file_path is not used by the majority of users so they have no memory consumption issue.

Some customers use config.example_status_persistence_file_path and they use RSpec in Queue Mode and this can cause increased memory consumption. This is the issue you discovered.

When we merge PR #226 then the issue won't exist anymore for the customers. So let's focus on the PR.

I'm closing this one for now.

@ArturT ArturT closed this as completed Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants