question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Excessive amount of error 500

See original GitHub issue

I’m using this library (v2.0.11) via Home Assistant. My log sees a LOT of error messages that look like this:

Unable to parse response :<!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
  <title>Error 500 (Server Error)!!1</title>
  <style>
    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
  </style>
  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
  <p><b>500.</b> <ins>That’s an error.</ins>
  <p>The server encountered an error and could not complete your request.<p>If the problem persists, please <A HREF="http://www.google.com/support/">report</A> your problem and mention this error message and the query that caused it.  <ins>That’s all we know.</ins>
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/locationsharinglib/locationsharinglib.py", line 389, in _get_data
    data = json.loads(response.text.split("'", 1)[1])
IndexError: list index out of range

They seem to come in bunches. It would be really nice to at least more gracefully handle this exception, like write a small error message to the log that says something like the server could not satisfy the query or something. As it is it looks like the code doesn’t expect this to happen.

It would be even nicer if it could filter out some of the consecutive messages. I did this with one of my HA components. I.e., if the same error happens twice in a row, say in the error message that further errors will not be shown until the errors stop. Then when the query works again, write a message saying things are ok again (maybe even giving a count of how many consecutive errors happened.)

Bottom line, though, is my log gets flooded with these messages and which makes it hard to see other problems that might be happening.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
costastfcommented, Sep 16, 2018

Hi all,I am currently on vacation and will not be able to work on this until after the 24th. Handling this error better is something that will be done. The library was written in such a way as to force this kind of feedback since it is quite exploratory. The 500 errors could be made into warnings but I don’t think that we should go implementing a state machine for the errors so we rate limit them. I think that specifically the 500 errors sound be made into a warning so it does not spam HA logs but everything else should still break since this is a reverse engineered project and has not been made on top of an official api. There are many possible responses and I think that Google has different services depending on your geo location so I would like to catch everything in time and cover all cases, and masking errors will make it much more difficult.

2reactions
ve6rahcommented, Sep 14, 2018

I think this really requires more than simply hiding these errors.

These errors are causing me massive delays in updates to the location. If I use Google Maps and check the location, it is a maximum of maybe 5-10 minutes old, however using locationsharinglib locations are often an hour old or more. This is while my log fills up with this error message. Previously (before my log starting filling with this error) the update time on locationsharinglib was quite reasonable.

Without a fix for the underlying issue, the usability of this module is severely compromised. Hiding the error message won’t fix that. (Though I will admit that the library should ALSO handle the error more gracefully, a single line in the log is more than enough)

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is a 500 Internal Server Error? - Allconnect.com
The 500 Internal Server Error is simply a general indication that something's wrong on the server side. Several things could cause this, but ......
Read more >
500 Internal Server Error - HTTP - MDN Web Docs - Mozilla
This error response is a generic "catch-all" response. Usually, this indicates the server cannot find a better 5xx error code to response.
Read more >
How to Fix a 500 Internal Server Error on Your WordPress Site
The 500 Internal Server Error status code occurs when the server encounters an error that prevents it from fulfilling the request.
Read more >
What Is a 500 Error & How to Fix It | Sucuri Blog
1. This is a good troubleshooting step. This is done before looking for more debugging on your site to confirm that the issue...
Read more >
What Is a "500 Internal Server Error" and How Do I Fix It?
This error means there is a problem on the server side. A server error can be caused by any number of things from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found