Fossil Forum
Post: HTTP status 500, not 400, for server-side errors such as "out of memory"?
The thread talks about the fossil server failing with an "out of memory" error and returning an HTTP response with status code 400, "Bad Request".
I think that 400 is the wrong status code to use for this error condition, and that status code 500, "Internal Server Error", would be more appropriate.
A response status code of 400 means there is something wrong with what the client sent, which is not the case here. It's not as though the client can add missing HTTP header, or something, to make the request succeed. It may well be that an identical request will succeed at a different time, when circumstances on the server are different.
A response status code of 500 indicates that the problem is with the server, not the client, and that it likely cannot be fixed without server administrator attention.
Besides "out of memory", I was able to induce the 400 response status code
for a "database is locked" error, by starting a fossil commit in autosync mode
and leaving it with the editor open, then running fossil ui and clicking the "Home" menu item.
This, too, is not a good match for a "Bad Request" response.
I agree with this, I think it would have helped a lot to have a 500 instead of a 400, I would have been more encline to ask for server admin help sooner, instead of focusing on the client side.
I think that 400 is the wrong status code to use for this error condition, and that status code 500, "Internal Server Error", would be more appropriate.
FWIW, i don't think anyone disputes that, we've just not gotten around to exploring the required changes yet. This topic is flagged in my inbox for later investigation but my current backlog is doing its backlog thing.
An OOM is, nowadays, a rarity of a rarity, which somewhat reduces the severity.