-
Notifications
You must be signed in to change notification settings - Fork 192
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
bodhi API sometimes returns responses with empty bodies instead of JSON #4044
Comments
Can you post an example query for which you see the problem? What model are you quering? Updates? |
It happens intermittently for almost all endpoints, including comments, updates, and overrides. Querying packages and users seem to be mostly unaffected, and releases returns too few values to be a good data point. I've tried to reproduce it today, and running this python3 script in two terminals side by side eventually triggered the bug (after a minute or so): import requests
while True:
requests.get("https://bodhi.fedoraproject.org/overrides/?rows_per_page=100&page=10&releases=EPEL-8").json() This crashes with an exception as soon as an empty response is encountered, because an empty string is not valid JSON. An empty response was returned from bodhi in the first terminal ( |
Oh, well, the problem seems to be in the nearly 300 buildroot overrides for EPEL-8 from tdawson. All of these had their notes updated a million times and at every update the new text was appended to the existing, causing them to become gigantic... @cverna what do you think? Since this will bring a db migration, how should we handle existing records with more than the new limit? Should we just discard everything beyond the limit? |
I don't think this is a timeout issue. The returned HTTP response has a 200 code, just an empty response body. I don't see how that's possible from looking at the bodhi server code. |
yeah, I misspoke. I mean that the object serialization routine hits some timeouts and sends out data before finishing the object when we try to access those overrides. I've looked into the code and that happened because every time a BRO is submitted as new, but another BRO with the same build already exists, the old one is used and the new notes are added. So, if one repeatedly create a BRO for the same build nvr, we will end up with gigantic notes, as the example I posted. I'm going to submit a PR to avoid that, by limiting override notes to a maximum of XXX chars (500? 1.000?) and dropping the older lines in a situation like this. And we will need to truncate the notes of those problematic overrides manually with a direct query on the database, but that's beyond my privileges... I can prepare the appropriate query to reduce work to admins, if needed. |
That should certainly help. But unless today is a day where I should not think about programming, then this will not address the underlying issue where sometimes faulty responses are sent? |
OK, I've posted a PR that in future should prevent a situation like this. I'll leave this ticket open as a remainder for the faulty responses, but I can't say what closes the connection while the data is still flowing, if it's on to the server or the client side. |
As the issue title states, sometimes, but it seems especially when bodhi is "under load", or when setting
rows_per_page
parameter to a bigger value than the default (e.g. 100), querying the bodhi REST API yields server responses with empty HTTP message bodies, but a "success" HTTP code.This leads to all kinds of problems (and it's something that I have to actively work around in my bodhi rust client bindings by having a special failure case for "successful" responses with empty response bodies instead of valid JSON).
Since this is a transient / random issue, I don't have exact steps to reproduce it, except for doing some API requests until you get a response with an empty HTTP body instead of JSON.
The text was updated successfully, but these errors were encountered: