You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Handle the JSON parse error in HParams plugin (#5970)
## Motivation for features / changes
Currently, feeding badly formatted request data to
`tb.corp/experiment/<id>/data/plugin/hparams/experiment` endpoint can
result in 500s (see
[b/250791957](https://b.corp.google.com/issues/250791957)):
```
...
raise ParseError('Failed to load JSON: {0}.'.format(str(e)))
google3.net.proto2.python.public.json_format.ParseError: Failed to load JSON: Expecting value: line 1 column 1 (char 0).
```
The 500s are confusing to the end users because they will see an
`Internal Server Error` page without any useful debugging information.
It also adds unnecessary noise to the logging/monitoring system which
makes it hard to found the real alerts.
## Technical description of changes
This CL catches the JSON ParseError, logs the request data for
debugging, and throws 400s.
## Screenshots of UI changes
<img width="1105" alt="image"
src="https://user-images.githubusercontent.com/88216042/195377616-d06b4bd8-0532-4b37-9f09-d6e7b8dc5885.png">
## Detailed steps to verify changes work correctly (as executed by you)
Open the browser and enter the hparams plugin endpoint of an experiment
that feeds the badly-formatted request data, e.g
`/experiment/1811564056169732114/data/plugin/hparams/experiment?request=blah`
and you should see the UI changes above rather than an `Internal Server
Error` page.
0 commit comments