datagrepper icon indicating copy to clipboard operation
datagrepper copied to clipboard

502 Error when searching with high delta on few users

Open mattiaverga opened this issue 3 years ago • 3 comments

Searching for actions from a few users causes 502 Error response when using high delta in query. For example: https://apps.fedoraproject.org/datagrepper/raw/?user=karsten&category=bodhi&order=desc&rows_per_page=50&delta=5184000

I can reproduce every time with user karsten with a delta of 60 days, but I don't think it's due to too many entries detected for the user, as a delta of just 30 days shows no entries (but it takes a lot of time). Querying other users with the same delta and with much more activity doesn't show any problem and the reply is blazing fast. For example: https://apps.fedoraproject.org/datagrepper/raw/?user=mattia&category=bodhi&order=desc&rows_per_page=50&delta=5184000

mattiaverga avatar Aug 09 '22 06:08 mattiaverga

I've reproduced it, thanks for reporting. There's possible a short term fix which is to increase the timeout on the gunicorn server, as the query actually takes 1m15s and the timeout is at 1m. But it's strange that the query takes that long, I'm going to try to reproduce on staging and try some things.

abompard avatar Aug 11 '22 07:08 abompard

Hmm, it's very fast on staging unfortunately.

abompard avatar Aug 11 '22 07:08 abompard

Some more background about the bug: I've seen this while running a script that checks users activity with a delta of 1 year, the full URL queried by the script is: https://apps.fedoraproject.org/datagrepper/raw/?user={p}&category=bodhi&order=desc&delta=31536000&rows_per_page=50&page={page}

The 1 year delta is not a problem for the vast majority of users, but for some reason for a few users the query slows down at the point the server response times out. The users causing this odd behavior are always the same, user karsten is one of them, I can report some other if it can help. Running the same query for the problematic user without the delta parameter makes the query as fast as for other users: https://apps.fedoraproject.org/datagrepper/raw/?user=karsten&category=bodhi&order=desc&rows_per_page=50 but by adding even a small amount to the delta parameter makes the query slow down: https://apps.fedoraproject.org/datagrepper/raw/?user=karsten&category=bodhi&order=desc&rows_per_page=50&delta=172800

mattiaverga avatar Aug 11 '22 16:08 mattiaverga