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

Update dependency moka to v0.12.1 #7075

Merged
merged 1 commit into from
Oct 16, 2023
Merged

Conversation

tatsuya6502
Copy link
Contributor

Please do not merge this pull request yet.

Hi. We are planning to release a new version of moka cache sometime soon, hopefully in a couple of weeks from now. It has major breaking changes (for good reasons) and this PR updates the codes for it. v0.12.0 is currently in beta so this pull request (PR) is depending on the latest v0.12.0-beta.2 for now.

For details of the breaking changes, please see the MIGRATION-GUIDE.md.

I will let you know when moka v0.12.0 is released, but since this is the biggest change in moka's history (e.g. one of the PRs had +5,624 −963 lines in the diff), I am a bit concerned if we have introduced any regressions. Perhaps, you may want to hold off merging this PR until we become confident about v0.12.0.

Thanks!

@bors
Copy link
Contributor

bors commented Sep 8, 2023

☔ The latest upstream changes (presumably 3d61a79) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Contributor

bors commented Sep 17, 2023

☔ The latest upstream changes (presumably #7123) made this pull request unmergeable. Please resolve the merge conflicts.

@tatsuya6502 tatsuya6502 force-pushed the moka-v0.12 branch 2 times, most recently from 571dafb to f060283 Compare September 18, 2023 11:34
@tatsuya6502
Copy link
Contributor Author

I released moka v0.12.0 two days ago, and the number of v0.12.0 downloads is growing, accounting for about 11.6% of the total downloads yesterday. I will continue monitoring the download numbers.

moka-2023-09-19

There were significant internal changes in v0.12.0. I did some additional testing and code review last week, but I am still a bit concerned about regressions (e.g. causing fatal failures like deadlocks). As for crates.io, I do not think there is any rush to upgrade moka, so we will probably wait two or more weeks before upgrading? Let's wait and see if other v0.12.0 users report any problems.

I will give you an update in early October, or when any problems are reported.

@Turbo87
Copy link
Member

Turbo87 commented Sep 20, 2023

As for crates.io, I do not think there is any rush to upgrade moka, so we will probably wait two or more weeks before upgrading? Let's wait and see if other v0.12.0 users report any problems.

I will give you an update in early October, or when any problems are reported.

sounds good to me, thanks! :)

@Turbo87 Turbo87 mentioned this pull request Sep 20, 2023
1 task
@tatsuya6502
Copy link
Contributor Author

Unfortunately, an issue was reported for moka v0.12. We are looking into it now.

@bors
Copy link
Contributor

bors commented Oct 2, 2023

☔ The latest upstream changes (presumably f6d24d8) made this pull request unmergeable. Please resolve the merge conflicts.

@tatsuya6502 tatsuya6502 changed the title DO NOT MERGE: Update dependency moka to v0.12.0 DO NOT MERGE: Update dependency moka to v0.12.1 Oct 4, 2023
@tatsuya6502
Copy link
Contributor Author

tatsuya6502 commented Oct 4, 2023

Unfortunately, an issue was reported for moka v0.12. We are looking into it now.

We identified a bug introduced in moka v0.12.0 and fixed it. We have published moka v0.12.1 with the fix and I updated this pull request to use it.

Let's wait for few more days to see if moka v0.12.1 fixes the memory leak at the user side.

https://github.com/moka-rs/moka/blob/v0.12.1/CHANGELOG.md#version-0121

Version 0.12.1

Fixed

  • Fixed memory leak in future::Cache that occurred when get_with(), entry().or_insert_with(), and similar methods were used (#329).
    • This bug was introduced in v0.12.0. Versions prior to v0.12.0 do not have this bug.

Changed

  • (Performance) Micro-optimize ValueInitializer (#331, by @Swatinem).

@tatsuya6502
Copy link
Contributor Author

Let's wait for few more days to see if moka v0.12.1 fixes the memory leak at the user side.

It looks good; they are seeing no sign of memory leak in moka v0.12.1.

Just for sure, I will wait until Tuesday afternoon in my time zone (UTC+0800), and if no other issues are reported, I will mark this pull request ready for review.

@Turbo87 Turbo87 mentioned this pull request Oct 6, 2023
1 task
@bors
Copy link
Contributor

bors commented Oct 9, 2023

☔ The latest upstream changes (presumably 0d8472a) made this pull request unmergeable. Please resolve the merge conflicts.

@Turbo87
Copy link
Member

Turbo87 commented Oct 10, 2023

👋 since I will be at the EuroRust conference starting tomorrow, I most likely won't have time to monitor the production environment sufficiently enough to merge this just yet. we might have to delay this until next week it that's okay with you :)

@tatsuya6502
Copy link
Contributor Author

we might have to delay this until next week it that's okay with you :)

Yes, it is okay. Let's delay it until next week or whenever convenient for you.

I will watch EuroRust online. Arpad Borsos (Swatinem) will mention moka in his session as he found the mem::size_of issue of Futures while using an older version of moka.

@bors
Copy link
Contributor

bors commented Oct 16, 2023

☔ The latest upstream changes (presumably 88ebde4) made this pull request unmergeable. Please resolve the merge conflicts.

@Turbo87 Turbo87 changed the title DO NOT MERGE: Update dependency moka to v0.12.1 Update dependency moka to v0.12.1 Oct 16, 2023
@Turbo87 Turbo87 marked this pull request as ready for review October 16, 2023 08:46
@Turbo87
Copy link
Member

Turbo87 commented Oct 16, 2023

I've rebased this to fix the merge conflict with the lockfile update. I'm currently deploying this to our staging environment to test it out there and will hopefully merge this afterwards.

@Turbo87
Copy link
Member

Turbo87 commented Oct 16, 2023

I've tested the PR on the staging environment and couldn't see any immediate issues. I'll merge this now and will deploy it to production afterwards.

@Turbo87 Turbo87 merged commit e1dcc7e into rust-lang:main Oct 16, 2023
6 checks passed
// by "Cannot start a runtime from within a runtime"). Here, we are in
// a spawn_blocking call because of conduit_compat, so our current thread
// is not an executor of the runtime.
rt.block_on(app.version_id_cacher.insert(cache_key, version_id))
Copy link
Member

@Turbo87 Turbo87 Nov 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tatsuya6502 is there a reason why you extracted the rt variable outside of the conduit_compat() closure instead of using Handle::current().block_on(...) directly here? we've been using Handle::current().block_on(...) in a few other places and I'm trying to figure out if that is a mistake or not 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi. I did not realize that you already had Handle::current().block_on(...) in other places. I never tried doing so, and I am not sure if it is okay or not.

I had an impression that Handle::current() should be called in async context. But I just checked Tokio's document and it seems I was wrong. It says the followings:

https://docs.rs/tokio/1.33.0/tokio/runtime/struct.Handle.html#method.current

pub fn current() -> Self

Returns a Handle view over the currently running Runtime.

Panics

This will panic if called outside the context of a Tokio runtime. That means that you must call this on one of the threads being run by the runtime, or from a thread with an active EnterGuard.

It says "outside the context of Tokio runtime", not "async context". conduit_compat runs the given closure in tokio::task::spawn_blocking, which uses a pool of threads being run by Tokio runtime. So, if understand correctly, calling Handle::current() should be okay there.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, thanks for the clarification. I guess we'll try it out and see what happens. The test suite seems to work fine that way at least.

@tatsuya6502 tatsuya6502 deleted the moka-v0.12 branch November 8, 2023 15:12
Turbo87 added a commit to Turbo87/crates.io that referenced this pull request Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants