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

Issue with specific cache key #287

Closed
dbhaasis opened this issue May 17, 2022 · 5 comments
Closed

Issue with specific cache key #287

dbhaasis opened this issue May 17, 2022 · 5 comments
Assignees

Comments

@dbhaasis
Copy link

dbhaasis commented May 17, 2022

Ran into weird issue where a specific cache key seems to be getting in infinite loop or something. The cache (:resolver_cache) was set up with a short cache time of 1 second as only used to prevent multiple calls in same graphql request in absinthe.

Here is call that would never return.
Cachex.fetch(:resolver_cache, {:season_tags, 1707, 23702601}, fn {_,_,_} -> "something" end)

Changing any of the 3 values would make the call work as expected, but this combination of :season_tags and the 2 numbers caused the request to get stuck. We changed to use a string instead of atom for the sub area of the cache to make it work, but seems strange that the combination of values caused fetch to hang.


UPDATE: So it seems to be an issue with the cache getting into a weird state and a specific key causing the issue. As this issue has happened several times. When in this state, clearing the cache does not fix the issue. Restarting the app does fix the issue. I'm guessing somehow the key is getting stored somewhere that doesn't actually show up as being in the cache and is in an invalid state which causes the fetch to hang.

@whitfin
Copy link
Owner

whitfin commented Jul 9, 2022

@dbhaasis are you able to provide a reproduction case for this? If you run this in an empty project, does it still happen?

@whitfin whitfin self-assigned this Jul 9, 2022
@dbhaasis
Copy link
Author

dbhaasis commented Jul 11, 2022 via email

@whitfin
Copy link
Owner

whitfin commented Jul 11, 2022

Calls to fetch/4 will routinely hang as they're queued up through another service and executed in the background. I can only assume that somehow your fetching function either crashed or just didn't return.

Were you doing anything specifically complicated inside your fetch function? Obviously "something" is just a placeholder, right?

It makes sense to be something with the fetching service, as clearing the cache would not clear the state of fetches flowing through that service.

@whitfin
Copy link
Owner

whitfin commented Nov 23, 2022

I'm going to close this for now but feel free to follow up with a reproduction case or more information if you have any, and I can look again!

@whitfin
Copy link
Owner

whitfin commented Dec 11, 2023

It looks (tentatively) like this has been reproduced as a legitimate issue, so further discussion and work on this will happen in #319 where we're trying to work on a reproduction case!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants