spedas / pyspedas

Python-based Space Physics Environment Data Analysis Software
https://pyspedas.readthedocs.io/
MIT License
149 stars 58 forks source link

Confusing json decoding error if MMS data server is down #864

Closed jameswilburlewis closed 4 months ago

jameswilburlewis commented 4 months ago

We had an issue at the PyHC summer school today where students were getting strange JSON decoding errors trying to load MMS state data. It turns out that the MMS data server was down, returning HTTP 503 "Service Unavailable" errors instead of the expected file list.

In this code:

                with warnings.catch_warnings():
                    warnings.simplefilter("ignore", category=ResourceWarning)
                    http_request = sdc_session.get(url, verify=True)
                    http_json = http_request.json()

the return code of http_request should be checked before trying to decode the json, so we can give a more appropriate error message. (Or maybe there was one, but got suppressed with the catch_warnings() clause?)

tmw233 commented 4 months ago

I'm having the same error message when trying to load any MMS data.

JSONDecodeError

Since ~4 days ago.

Does this mean the MMS data server is still down?

bpwrs commented 4 months ago

I would think so yes, I am also having this same error and have been for several days. It is possible to browse the SDC data directly, but the search function https://lasp.colorado.edu/mms/sdc/public/search/ is also non-functioning. That leads me to believe that there may not be some issue with the entire server, maybe just the query function of pyspedas or the portion of the server that is searchable is down.

jameswilburlewis commented 4 months ago

The fact that the SDC data browser isn't working is a very interesting piece of information! I see the same thing from my laptop, even though I'm not getting any errors using PySPEDAS to download MMS data, and all the MMS unit tests are passing. I will pass that along to my MMS SDC contacts and see if that helps them resolve the ongoing access issues.

jameswilburlewis commented 4 months ago

I've just heard from one of the MMS folks, and the data server issues may be fixed now. My notebooks using MMS data are now running properly in the summer school heliocloud. Please give it a try @tmw233 and @bpwrs, and let me know if it's working for you now, or if you're still seeing the JSON errors from unsuccessful MMS SDC connections.

tmw233 commented 4 months ago

Yes it seems to be fixed.

Thank you for passing on this message!

bpwrs commented 4 months ago

Working for me as well!!

jameswilburlewis commented 4 months ago

MMS data center is back online; if it happens again, pyspedas 1.5.13 and later should give more sensible diagnostic messages.