smarthomeNG / plugins

Plugins for SmartHomeNG - The device integration platform for your smart home
https://www.smarthomeNG.de
45 stars 103 forks source link

websocket module exceptions #512

Closed onkelandy closed 2 years ago

onkelandy commented 3 years ago
Mai 09 04:12:08 ERROR    modules.websocket update_item - Error in 'await websocket.send(data)': code = 1001 (going away), no reason
Traceback (most recent call last):
  File "/usr/local/smarthome/modules/websocket/__init__.py", line 920, in update_item
    await websocket.send(msg)
  File "/home/smarthome/.local/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 471, in send
    await self.ensure_open()
  File "/home/smarthome/.local/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 726, in ensure_open
    raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedOK: code = 1001 (going away), no reason
Mai 09 04:12:08 ERROR    modules.websocket update_item - Error in 'await websocket.send(data)': code = 1001 (going away), no reason
Traceback (most recent call last):
  File "/usr/local/smarthome/modules/websocket/__init__.py", line 920, in update_item
    await websocket.send(msg)
  File "/home/smarthome/.local/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 471, in send
    await self.ensure_open()
  File "/home/smarthome/.local/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 726, in ensure_open
    raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedOK: code = 1001 (going away), no reason
Mai 09 04:12:08 ERROR    modules.websocket update_item - Error in 'await websocket.send(data)': code = 1001 (going away), no reason
Traceback (most recent call last):
  File "/usr/local/smarthome/modules/websocket/__init__.py", line 920, in update_item
    await websocket.send(msg)
  File "/home/smarthome/.local/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 471, in send
    await self.ensure_open()
  File "/home/smarthome/.local/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 726, in ensure_open
    raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedOK: code = 1001 (going away), no reason
Mai 09 04:12:08 ERROR    modules.websocket update_item - Error in 'await websocket.send(data)': code = 1001 (going away), no reason
Traceback (most recent call last):
  File "/usr/local/smarthome/modules/websocket/__init__.py", line 920, in update_item
    await websocket.send(msg)
  File "/home/smarthome/.local/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 471, in send
    await self.ensure_open()
  File "/home/smarthome/.local/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 726, in ensure_open
    raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedOK: code = 1001 (going away), no reason
Mai 09 04:12:08 ERROR    modules.websocket update_item - Error in 'await websocket.send(data)': code = 1001 (going away), no reason
Traceback (most recent call last):
  File "/usr/local/smarthome/modules/websocket/__init__.py", line 920, in update_item
    await websocket.send(msg)
  File "/home/smarthome/.local/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 471, in send
    await self.ensure_open()
  File "/home/smarthome/.local/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 726, in ensure_open
    raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedOK: code = 1001 (going away), no reason
Mai 09 04:12:08 ERROR    modules.websocket update_item - Error in 'await websocket.send(data)': code = 1001 (going away), no reason
Traceback (most recent call last):
  File "/usr/local/smarthome/modules/websocket/__init__.py", line 920, in update_item
    await websocket.send(msg)
  File "/home/smarthome/.local/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 471, in send
    await self.ensure_open()
  File "/home/smarthome/.local/lib/python3.8/site-packages/websockets/legacy/protocol.py", line 726, in ensure_open
    raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedOK: code = 1001 (going away), no reason
Mai 09 04:12:12 WARNING  modules.websocket Series cancelation: No series for path bewegung.aussen.terrasse_og.fuenf found in list
Mai 09 04:12:12 WARNING  modules.websocket smartVISU_protocol_v4: Exception in 'await websocket.send(reply)': code = 1001 (going away), no reason - reply = {"cmd": "series_cancel", "error": "No series for path bewegung.aussen.terrasse_og.fuenf found in list"}
Mai 09 04:12:12 WARNING  modules.websocket Series cancelation: No series for path bewegung.og.fuenf found in list
Mai 09 04:12:12 WARNING  modules.websocket smartVISU_protocol_v4: Exception in 'await websocket.send(reply)': code = 1001 (going away), no reason - reply = {"cmd": "series_cancel", "error": "No series for path bewegung.og.fuenf found in list"}
Mai 09 04:12:12 WARNING  modules.websocket Series cancelation: No series for path bewegung.og.kueche.fuenf found in list
Mai 09 04:12:12 WARNING  modules.websocket smartVISU_protocol_v4: Exception in 'await websocket.send(reply)': code = 1001 (going away), no reason - reply = {"cmd": "series_cancel", "error": "No series for path bewegung.og.kueche.fuenf found in list"}
Mai 09 04:12:12 WARNING  modules.websocket Series cancelation: No series for path bewegung.og.abgang.fuenf found in list
Mai 09 04:12:12 WARNING  modules.websocket smartVISU_protocol_v4: Exception in 'await websocket.send(reply)': code = 1001 (going away), no reason - reply = {"cmd": "series_cancel", "error": "No series for path bewegung.og.abgang.fuenf found in list"}
Mai 09 04:12:12 WARNING  modules.websocket Series cancelation: No series for path bewegung.og.wc.fuenf found in list
Mai 09 04:12:13 WARNING  modules.websocket smartVISU_protocol_v4: Exception in 'await websocket.send(reply)': code = 1001 (going away), no reason - reply = {"cmd": "series_cancel", "error": "No series for path bewegung.og.wc.fuenf found in list"}
Mai 09 04:12:13 WARNING  modules.websocket smartVISU_protocol_v4: Exception in 'await websocket.send(reply)': code = 1001 (going away), no reason - reply = {"cmd": "item", "items": [["bewegung.eg.zeitstatus", 30], ["bewegung.eg.gang.zeitstatus", 30], ["bewegung.eg.bad.zeitstatus", 0], ["bett.belegung", 2], ["bett.andy", false], ["bett.andy.sperren", false], ["bett.riki", true], ["bett.riki.sperren", false], ["bwm.eg.bad.nachlaufzeit_aktiv", false], ["bwm.eg.bad.nachlaufzeit_aktiv.start.unix_timestamp", 0], ["bwm.eg.bad.nachlaufzeit.duration_format", "0h 5i 0s"], ["wetterstation.helligkeit.osten", 1.0], ["bwm.eg.bad.helligkeitstrigger", true], ["bwm.eg.bad.helligkeitsschwelle", 8000], ["bwm.eg.bad.nachlaufzeit", 5], ["bwm.eg.bad.sperren", false], ["bwm.eg.bad.visu_mastertrigger", false], ["bwm.eg.bad.visu_trigger", false], ["bwm.eg.bad.austrigger", false], ["bwm.eg.gang.nachlaufzeit_aktiv", false], ["bwm.eg.gang.nachlaufzeit_aktiv.start.unix_timestamp", 0], ["bwm.eg.gang.nachlaufzeit.duration_format", "0h 0i 0s"], ["bwm.eg.gang.helligkeitswert", 0.0], ["bwm.eg.gang.helligkeitstrigger", true], ["bwm.eg.gang.helligkeitsschwelle", 0.0], ["bwm.eg.gang.nachlaufzeit", 0], ["bwm.eg.gang.reichweite", 0], ["bwm.eg.gang.sperren", false], ["bwm.eg.gang.visu_mastertrigger", false], ["bwm.eg.gang.visu_trigger", false], ["bwm.eg.gang.immerdunkel", false], ["bwm.eg.bad.automatik.settings.nacht.helligkeitsschwelle", 8000], ["bwm.eg.bad.automatik.settings.standard.helligkeitsschwelle", 8900], ["bwm.eg.bad.automatik.settings.nacht.nachlaufzeit", 5], ["bwm.eg.bad.automatik.settings.standard.nachlaufzeit", 14]]}
Mai 09 04:12:13 WARNING  modules.websocket smartVISU_protocol_v4: Exception in 'await websocket.send(reply)': code = 1001 (going away), no reason - reply = {"cmd": "series", "series": [[1620439933058, 0.0], [1620449671282, 1.0], [1620450116880, 0.0], [1620454444378, 1.0], [1620456015003, 0.0], [1620456130745, 1.0], [1620456853330, 0.0], [1620456983935, 1.0], [1620457420163, 0.0], [1620458409284, 1.0], [1620458718198, 0.0], [1620458879584, 1.0], [1620459755501, 0.0], [1620459769008, 1.0], [1620460376303, 0.0], [1620466487010, 1.0], [1620466859127, 0.0], [1620467550240, 1.0], [1620467978769, 0.0], [1620471740312, 1.0], [1620472109984, 0.0], [1620477198716, 1.0], [1620477670798, 0.0], [1620479275388, 1.0], [1620479596804, 0.0], [1620483100100, 1.0], [1620484003455, 0.0], [1620491116347, 1.0], [1620491583346, 0.0], [1620491921600, 1.0], [1620492230796, 0.0], [1620501201890, 1.0], [1620501529600, 0.0], [1620501579021, 1.0], [1620501906024, 0.0], [1620502552805, 1.0], [1620503000972, 0.0], [1620520522084, 1.0], [1620520939021, 0.0], [1620520939021, 0.0], [1620526333058, 0.0]], "sid": "bewegung.eg.bad.fuenf|raw|24h|now|500"}
Mai 09 04:12:13 WARNING  modules.websocket smartVISU_protocol_v4: Exception in 'await websocket.send(reply)': code = 1001 (going away), no reason - reply = {"cmd": "series", "series": [[1620439933190, 0.0], [1620446416919, 1.0], [1620446720612, 0.0], [1620448476570, 1.0], [1620448942183, 0.0], [1620449479227, 1.0], [1620450131410, 0.0], [1620450530216, 1.0], [1620450846399, 0.0], [1620452913628, 1.0], [1620453274260, 0.0], [1620454321146, 1.0], [1620454997087, 0.0], [1620455395505, 1.0], [1620457442185, 0.0], [1620457467085, 1.0], [1620457878361, 0.0], [1620458328348, 1.0], [1620460569763, 0.0], [1620464555459, 1.0], [1620464894145, 0.0], [1620466152520, 1.0], [1620466870048, 0.0], [1620467285642, 1.0], [1620467976715, 0.0], [1620471380059, 1.0], [1620472167614, 0.0], [1620472321784, 1.0], [1620472629868, 0.0], [1620476252277, 1.0], [1620476609856, 0.0], [1620477193369, 1.0], [1620477669298, 0.0], [1620477690675, 1.0], [1620478217298, 0.0], [1620478439018, 1.0], [1620478747380, 0.0], [1620479274982, 1.0], [1620479593779, 0.0], [1620483099348, 1.0], [1620483440913, 0.0], [1620483596799, 1.0], [1620483998918, 0.0], [1620484573454, 1.0], [1620484905238, 0.0], [1620485337551, 1.0], [1620485869076, 0.0], [1620487664216, 1.0], [1620487967625, 0.0], [1620488321128, 1.0], [1620488639830, 0.0], [1620491066316, 1.0], [1620491581318, 0.0], [1620491915046, 1.0], [1620492254338, 0.0], [1620492351104, 1.0], [1620492688020, 0.0], [1620499030601, 1.0], [1620499374663, 0.0], [1620501012284, 1.0], [1620501523059, 0.0], [1620501579224, 1.0], [1620501901502, 0.0], [1620502550825, 1.0], [1620502996433, 0.0], [1620520519873, 1.0], [1620520938494, 0.0], [1620525249642, 1.0], [1620525557644, 0.0], [1620525557644, 0.0], [1620526333190, 0.0]], "sid": "bewegung.eg.gang.fuenf|raw|24h|now|500"}
Mai 09 04:12:13 WARNING  modules.websocket smartVISU_protocol_v4: Exception in 'await websocket.send(reply)': code = 1001 (going away), no reason - reply = {"cmd": "series", "series": [[1620439933284, 1.0], [1620450866466, 0.0], [1620450938213, 1.0], [1620451769914, 0.0], [1620455426829, 1.0], [1620455531597, 0.0], [1620455845531, 1.0], [1620455870135, 0.0], [1620455881585, 1.0], [1620455962338, 0.0], [1620501656392, 1.0], [1620501704507, 0.0], [1620501722001, 1.0], [1620502545773, 0.0], [1620502709684, 1.0], [1620520511288, 0.0], [1620520654737, 1.0], [1620520673813, 0.0], [1620520682774, 1.0], [1620520694819, 0.0], [1620520702345, 1.0], [1620525241818, 0.0], [1620525241818, 0.0], [1620526333284, 0.0]], "sid": "bett.andy|raw|24h|now|500"}
Mai 09 04:12:13 WARNING  modules.websocket smartVISU_protocol_v4: Exception in 'await websocket.send(reply)': code = 1001 (going away), no reason - reply = {"cmd": "series", "series": [[1620439933379, 1.0], [1620446391842, 0.0], [1620446400375, 1.0], [1620446404638, 0.0], [1620446423208, 1.0], [1620448861380, 0.0], [1620448888003, 1.0], [1620448999306, 0.0], [1620449633475, 1.0], [1620449656495, 0.0], [1620455451923, 1.0], [1620455531096, 0.0], [1620455560221, 1.0], [1620455761764, 0.0], [1620455854072, 1.0], [1620455868624, 0.0], [1620455882083, 1.0], [1620455960833, 0.0], [1620459313273, 1.0], [1620459336365, 0.0], [1620472349602, 1.0], [1620481683619, 0.0], [1620481692652, 1.0], [1620482581636, 0.0], [1620482589659, 1.0], [1620497860621, 0.0], [1620498337063, 1.0], [1620499619353, 0.0], [1620501608708, 1.0], [1620501608708, 1.0], [1620526333380, 1.0]], "sid": "bett.riki|raw|24h|now|500"}
Mai 09 04:12:13 WARNING  modules.websocket smartVISU_protocol_v4: Exception in 'await websocket.send(reply)': code = 1001 (going away), no reason - reply = {"cmd": "series", "series": [[1620483133468, 1.0], [1620484219007, 0.0], [1620484316119, 1.0], [1620484910762, 0.0], [1620485322755, 1.0], [1620485869072, 0.0], [1620487663185, 1.0], [1620487995167, 0.0], [1620488303945, 1.0], [1620488642292, 0.0], [1620491059724, 1.0], [1620491583341, 0.0], [1620491915138, 1.0], [1620492254338, 0.0], [1620492351159, 1.0], [1620492688524, 0.0], [1620499023721, 1.0], [1620499382125, 0.0], [1620501009812, 1.0], [1620501529595, 0.0], [1620501579168, 1.0], [1620501906037, 0.0], [1620502550929, 1.0], [1620503000967, 0.0], [1620520519992, 1.0], [1620520939010, 0.0], [1620525249761, 1.0], [1620525557648, 0.0], [1620525557648, 0.0], [1620526333468, 0.0]], "sid": "bewegung.eg.fuenf|max|12h|now|5000"}
Mai 09 04:12:13 WARNING  modules.websocket smartVISU_protocol_v4: Exception in 'await websocket.send(reply)': code = 1001 (going away), no reason - reply = {"cmd": "series", "series": [[1620483133562, 1.0], [1620483440913, 0.0], [1620483596799, 1.0], [1620483998918, 0.0], [1620484573454, 1.0], [1620484905238, 0.0], [1620485337551, 1.0], [1620485869076, 0.0], [1620487664216, 1.0], [1620487967625, 0.0], [1620488321128, 1.0], [1620488639830, 0.0], [1620491066316, 1.0], [1620491581318, 0.0], [1620491915046, 1.0], [1620492254338, 0.0], [1620492351104, 1.0], [1620492688020, 0.0], [1620499030601, 1.0], [1620499374663, 0.0], [1620501012284, 1.0], [1620501523059, 0.0], [1620501579224, 1.0], [1620501901502, 0.0], [1620502550825, 1.0], [1620502996433, 0.0], [1620520519873, 1.0], [1620520938494, 0.0], [1620525249642, 1.0], [1620525557644, 0.0], [1620525557644, 0.0], [1620526333562, 0.0]], "sid": "bewegung.eg.gang.fuenf|max|12h|now|5000"}
Mai 09 04:12:13 WARNING  modules.websocket smartVISU_protocol_v4: Exception in 'await websocket.send(reply)': code = 1001 (going away), no reason - reply = {"cmd": "series", "series": [[1620483133648, 1.0], [1620484003455, 0.0], [1620491116347, 1.0], [1620491583346, 0.0], [1620491921600, 1.0], [1620492230796, 0.0], [1620501201890, 1.0], [1620501529600, 0.0], [1620501579021, 1.0], [1620501906024, 0.0], [1620502552805, 1.0], [1620503000972, 0.0], [1620520522084, 1.0], [1620520939021, 0.0], [1620520939021, 0.0], [1620526333648, 0.0]], "sid": "bewegung.eg.bad.fuenf|max|12h|now|5000"}

Came "out of the blue". The exceptions happened just once so far but I guess could be catched easily. The "no series for path.." happens quite often, still not sure why

wvhn commented 3 years ago

"no series for path.." is thrown if smartVISU tries to cancel a series which has already been cancelled. This happens if e.g. an event triggers a page change to the actual page. Old versions of the return home function do this and some users have copied that code into their own pages e.g. in order to show daytime related content. If your pages use this function you should implement a check whether the target page is already on display and then avoid the change. See actual code for the return home function in root.html.

IMHO the Websocket should send the "no series for path.." message to the client for debugging but avoid throwing a warning inside shNG. Why? Smartvisu wants to end series subscription and this is correctly fulfilled ;)

onkelandy commented 3 years ago

Hmm, I don't have any additional code on my pages. Maybe it's in quad_root.html but I don't think so. Any further ideas?

wvhn commented 3 years ago

There have been some obsolete event handlers in quad_root.html. The new file is now pushed to smartvisu/develop. Could you help testing and check if the double series_cancel is avoided?

onkelandy commented 3 years ago

Updated to the most recent develop branch. Still get the series cancellation stuff :( Mai 19 21:48:15 WARNING modules.websocket Series cancelation: No series for path licht.eg.bad.spiegel.dimmen found in list

msinn commented 3 years ago

No seriers for path … is thrown whenever smartVISU is requesting/canceling a series (for drawing plots) and the item does not exist.

For,me it happens mostly when having a visu page open, that used to reference the item and the cached page still calls formthatbitem.

Have you cleared all caches (sv and Browser)?

msinn commented 2 years ago

The abnormal closing of the websocket connection code = 1001 (going away), no reason is now logged as info (like code 1005 and 1006) and not raising an exception any more.

msinn commented 2 years ago

Since the issue is for the websocket module and not for the plugin, it should be placed in the core repo and not in the plugin repo.

onkelandy commented 2 years ago

I've made a new issue there though I am not sure if it still is an issue... Will observe.