I can also confirm that I receive that same error every single time I upgrade in the app/browser as well. I have tried adjusting the php parameters and it still occurs.
Although the upgrade does complete, it doesn’t reflect until later or doing the /update?secret=secret
The problem is that the update may take longer than the default gateway timeout.
What is most likely happening is that it is exceeding the 30 seconds which is why you are seeing the malformed json responses. The update will continue in the background however it will appear to “fail” due to this timeout.
We’d need to look into doing a multi step update whic downloads the file first, then runs the full update script, this would at least save the time it takes to download the file, which on some servers may be throttled and take a bit longer.