Server Issue (Detailed Information: list index out of range)
Closed this issue · 9 comments
@devopsec Can you please look into this.
@OsvaldoSierra can you provide the following:
- os info
- dsiprouter version
- cloud environment if applicable
- steps to reproduce your issue
For the last one in particular; what state was the system in before this issue occurred.
Hi guys. Here the info:
-
OS Info:
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/" -
DSIPRouter version: 0.70
-
Cloud enviroment: Huawei cloud (Hiperstack)
-
Just click on "Endpoint Groups" (Left menu) => Click on a Endpoint called "TroncalRemoto" => Next the error I've shown on my PS.
We haven't tested on the Huawei cloud platform but if your network settings are correct then that wouldn't be the cause of this issue.
Can you start dsiprouter in debug mode and attach the stack trace from /var/log/dsiprouter.log
?
You can start in debug mode by running:
dsiprouter restart -debug
@OsvaldoSierra please attach dsiprouter.log
from when this issue occurs
Hi team! Sure, I'll share it with you in a few hours
Hi team. Here I'm adding the dsiprouter.log. I've replied the error after dsiprouter restart -debug
command. The testing time was at:
root@dsiprouter-prueba-osvaldo:~# date
Sat 17 Dec 2022 02:28:46 AM CST
Issue occurs due to no weight
validation in endpoint group api checks.
This should not happen in normal use as the api puts in a default value.
Below is a workaround that will allow the attrs
column of the dispatcher
table to be empty:
diff --git a/gui/modules/api/api_routes.py b/gui/modules/api/api_routes.py
index 68f8d00..aea2c2b 100644
--- a/gui/modules/api/api_routes.py
+++ b/gui/modules/api/api_routes.py
@@ -862,9 +862,12 @@ def getEndpointGroup(gwgroupid):
dispatcher = db.query(Dispatcher).filter(Dispatcher.setid == gwgroupid)
if dispatcher:
weightList = {}
- for item in dispatcher:
- weight = item.attrs.split('=')[1]
- weightList[item.destination[4:]] = weight
+ try:
+ for item in dispatcher:
+ weight = item.attrs.split('=')[1]
+ weightList[item.destination[4:]] = weight
+ except IndexError:
+ pass
for endpoint in endpoints:
ep = {}
Will commit a better solution in v0.72, the workaround is only temporary