Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Stations tab causing "Internal Server Error"
#1
Just updated my install from GIT.  Everything seems to work ok - except when selecting the "stations" tab.  On the browser I get an  "Internal Server Error".  When running SIP from the command line I get:

Traceback (most recent call last):
  File "/home/pi/sip/web/application.py", line 239, in process
    return self.handle()
  File "/home/pi/sip/web/application.py", line 230, in handle
    return self._delegate(fn, self.fvars, args)
  File "/home/pi/sip/web/application.py", line 423, in _delegate
    return handle_class(cls)
  File "/home/pi/sip/web/application.py", line 399, in handle_class
    return tocall(*args)
  File "/home/pi/sip/webpages.py", line 254, in GET
    return template_render.stations()
  File "/home/pi/sip/web/template.py", line 1020, in template
    return self._base(t(*a, **kw))
  File "/home/pi/sip/web/template.py", line 881, in __call__
    return BaseTemplate.__call__(self, *a, **kw)
  File "/home/pi/sip/web/template.py", line 808, in __call__
    return self.t(*a, **kw)
  File "templates/stations.html", line 120, in __template__
    <input type="checkbox" ${"checked" if gv.sd['mo'][bid]&(1<<s) else ""} id="mc${sid}">
IndexError: list index out of range

192.168.2.29:40015 - - [24/Apr/2017 20:52:45] "HTTP/1.1 GET /vs" - 500 Internal Server Error


On a hunch I peeked at data/snames.json and everything looks reasonable (no sign of corruption):
["Front lawn", "Cherry Tree", "Flower Bed", "Northside Strip", "Rear Center Lawn", "Patio", "Rhubarb", "North Fence", "West Fence", "South Inside Fence", "South Outside Fence", "South Front", "S13", "S14", "S15", "S16"]


How can I help debug this bug?
Reply
#2
From the error it looks like there is a problem with the list of stations that activate the master valve.

The error "IndexError: list index out of range" of course means that Python is trying to read past the end of a list (array).
The list in question is the "mo": [] list which is in the sd.json file in the data directory. It looks like you have 16 stations (1 extension board) enabled. The "mo" list should have 2 entries e.g. "mo"[0, 0]. This list keeps track of the stations that enable the master.


If you look at the "'mo' entry in sd.json and don't see 2 elements in the list, try adding a second one.
You could also try setting the master to "none" in Options > Station Handling. That would eliminate the attempted read of the "mo" list but you would need to reset all the stations that enable the master when you re-select a master.

Another thing to check is the "nbrd" entry in sd.json. It should be;
 "nbrd": 2,
for 16 stations (number of expansion boards +1 for the base unit). If this has a higher number it could cause the IndexError but it would probably cause other problems as well.

Dan
Reply
#3
[quote pid='282' dateline='1493134568']
Quote:It looks like you have 16 stations (1 extension board) enabled.

Correct.

Quote:The "mo" list should have 2 entries e.g. "mo"[0, 0].

Confirmed: "mo": [0, 0]


Quote:Another thing to check is the "nbrd" entry in sd.json. It should be; "nbrd": 2

Confirmed: "nbrd": 2


Quote:You could also try setting the master to "none" in Options > Station Handling.

Before I reset, is there value in further debug?  Here is my sd.json file, with password and salt removed.

Code:
{"sdt": 0, "rsn": 0, "en": 1, "bsy": 0, "seq": 1, "lg": 1, "mton": 0, "ir": [0, 0], "snlen": 32, "mas": 0, "iw": [0], "nopts": 13, "tu": "C", "pwd": "b3BlbmRvb3I=", "ipas": 0, "htp": 80, "rst": 1, "password": "removed", "nst": 16, "rdst": 0, "lang": "default", "loc": "", "nprogs": 1, "tz": 48, "name": "SIP", "rs": 0, "mm": 1, "mo": [0, 0], "rbt": 0, "show": [255, 15], "mtoff": 0, "rd": 0, "theme": "basic", "lr": 100, "wl": 100, "urs": 0, "tf": 1, "salt": "removed", "nbrd": 2}


[/quote]
Reply
#4
I used your sd.json file and added in the default password and salt. That gave me the error you reported

Upon doing a document compare with a known good copy the "iw" entry had a value of [0] in the error producing copy and a value of [0, 0] in the known good copy. adding the second 0 fixed the problem.

The "iw" element is for the " Ignore Plugin adjustments?" column on the Stations page.

Dan
Reply
#5
(2017 Apr 26, 01:27 AM)dan Wrote: Upon doing a document compare with a known good copy the "iw" entry had a value of [0] in the error producing copy and a value of [0, 0] in the known good copy. adding the second 0 fixed the problem.

Confirmed.  Changing to iw [0, 0] allowed the station tab to load properly. 

I took at look at my backups, and it seems that the iw variable was introduced sometime before Sept 19, 2016.  It appears to always have been singular since appearing on my setup, so maybe some parsing changed between then and now.  At least there is a solution recorded in case others have the same issue.

Thanks for your help
Reply
#6
(2017 Apr 26, 02:46 AM)FWIW, I just had exactly the same error.  I was updating to the latest version of SIP from a version from several years ago.  Editing the sd.json file to make iw have the correct length (3 instead of 1, in my case) allowed the station page to load. jgmtfia Wrote:
(2017 Apr 26, 01:27 AM)dan Wrote: Upon doing a document compare with a known good copy the "iw" entry had a value of [0] in the error producing copy and a value of [0, 0] in the known good copy. adding the second 0 fixed the problem.

Confirmed.  Changing to iw [0, 0] allowed the station tab to load properly. 

I took at look at my backups, and it seems that the iw variable was introduced sometime before Sept 19, 2016.  It appears to always have been singular since appearing on my setup, so maybe some parsing changed between then and now.  At least there is a solution recorded in case others have the same issue.

Thanks for your help
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)