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

Bug: Counts indexes are not stable #237

Closed
tipogi opened this issue Dec 3, 2024 · 1 comment
Closed

Bug: Counts indexes are not stable #237

tipogi opened this issue Dec 3, 2024 · 1 comment
Labels
bug Something isn't working 👀 watcher

Comments

@tipogi
Copy link
Collaborator

tipogi commented Dec 3, 2024

When LUA script is trying to get the current value of a JSON path, sometimes, it returns a boolean instead of a number:

  • KEYS[1]: The index that we want to update. User:Counts:{user_pubky}
  • path: The property to update the value. Usually we decrement or increment: tags
 local current_value = redis.call('JSON.GET', KEYS[1], path)

This is the error that we get in the watcher logs:

ERROR pubky_nexus::events::processor] Error while handling event after 1 attempts: An error was signalled by the server - ResponseError: user_script:13: bad argument #1 to 'decode' (string expected, got boolean)

The bellow points, might be the reasons but still work in progress to detect the specific error. It is hard to reproduce maybe becasue lack of context:

  • Race Conditions: Multiple concurrent operations might update the same JSON path in Redis, leading to unexpected results
  • Dynamic JSON Updates: The JSON.SET command might have been used in different parts of your code to store values under the same path but with inconsistent types
  • ...
@tipogi tipogi self-assigned this Dec 3, 2024
@tipogi tipogi added bug Something isn't working 👀 watcher labels Dec 3, 2024
@tipogi tipogi pinned this issue Dec 5, 2024
@tipogi tipogi unpinned this issue Dec 5, 2024
@tipogi tipogi removed their assignment Dec 5, 2024
@tipogi
Copy link
Collaborator Author

tipogi commented Dec 5, 2024

after debugging more the watcher, the problem does not come from redis. More info about the errors here

@tipogi tipogi closed this as completed Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 👀 watcher
Projects
None yet
Development

No branches or pull requests

1 participant