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]: Posts / Comments from the future make hot_rank function crash. #3494

Closed
4 tasks done
phiresky opened this issue Jul 5, 2023 · 2 comments · Fixed by #3517
Closed
4 tasks done

[Bug]: Posts / Comments from the future make hot_rank function crash. #3494

phiresky opened this issue Jul 5, 2023 · 2 comments · Fixed by #3517
Labels
bug Something isn't working

Comments

@phiresky
Copy link
Collaborator

phiresky commented Jul 5, 2023

Requirements

  • Is this a bug report? For questions or discussions use https://lemmy.ml/c/lemmy_support
  • Did you check to see if this issue already exists?
  • Is this only a single bug? Do not put multiple bugs in one issue.
  • Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.

Summary

There's some posts that have a date in the future (e.g.
image
)

this causes the hot_rank function to throw. i don't know if this error actually happens in the wild, but it would cause hot rank updates to stop working mostly completely for all new posts.

i've managed to reproduce it synthetically which was maybe a bad idea:

  "message": "a negative number raised to a non-integer power yields a complex result",
  "context": "PL/pgSQL function hot_rank(numeric,timestamp without time zone) line 4 at RETURN",
  "statement": "WITH batch AS (SELECT a.id\n               FROM post_aggregates a\n               WHERE a.published > $1\n               ORDER BY a.published\n               LIMIT $2\n               FOR UPDATE SKIP LOCKED)\n         UPDATE post_aggregates a SET hot_rank = hot_rank(a.score, a.published),\n         hot_rank_active = hot_rank(a.score, a.newest_comment_time_necro)\n             FROM batch WHERE a.id = batch.id RETURNING a.published;\n    ",

Steps to Reproduce

  1. receive a post with time in the future via federation
  2. check published column
  3. hot_rank(score, published) will throw the above error

Technical Details

..

Version

0.18.1-rc

Lemmy Instance URL

No response

@phiresky phiresky added the bug Something isn't working label Jul 5, 2023
@RocketDerp

This comment was marked as abuse.

@phiresky
Copy link
Collaborator Author

phiresky commented Jul 5, 2023

There must be some federation issue on our or kbins side. This post has a timestamp of 2023-07-05T15:51:31+00:00 on kbin

https://fedia.io/m/firefox/t/71052/The-Firefox-Unleashed-These-Weeks-in-Firefox-Issue-141

and of Wednesday, July 5th, 2023 at 7:51:31 PM GMT+02:00 on lemmy: https://fedia.io/m/firefox/t/71052/The-Firefox-Unleashed-These-Weeks-in-Firefox-Issue-141

Lemmy doesn't use timestamptz which it definitely should everywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants