This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Bug in scada-remote "objects" request
#1
On some of my LogicMachines, I am encountering an error 500 "internal server error" when executing the scada-remote request for querying objects:

Code:
http://<LogicMachineIP>/scada-remote/?m=json&r=objects

This request produces the following error:
Code:
500 Internal Server Error

nginx


Note that on the same machines, the other requests that can be done with scada-remote (such as r=alerts or r=errors) work properly.

I decided to investigate the error logs of the nginx server, which are located in the following file:
Code:
/tmp/log/nginx/error.log

Here's what the error log contains:
Code:
2022/03/16 11:24:54 [error] 1105#0: *2681 lua entry thread aborted: runtime error: /usr/share/lua/genohm-scada.lua:0: attempt to compare number with nil
stack traceback:
coroutine 0:
    /usr/share/lua/genohm-scada.lua: in function 'decodevalue'
    /lib/genohm-scada/web/remote/objects.lua: in function </lib/genohm-scada/web/remote/objects.lua:0>
    /lib/genohm-scada/web/remote-handler.lua: in function </lib/genohm-scada/web/remote-handler.lua:0>, client: xxxxxxxx, server: , request: "GET /scada-remote/?m=json&r=objects HTTP/1.1", host: "xxxxxxxxx"

So the deep reason behind the error seems to be that the script /usr/share/lua/genohm-scada.lua tries to compare (>, <, =) a number with nil.
I tried to investigate inside the 3 files that seem to be involved (/usr/share/lua/genohm-scada.lua, /lib/genohm-scada/web/remote/objects.lua and /lib/genohm-scada/web/remote-handler.lua), but these files are binary (encoded). As a result it's impossible to debug these scripts.

Therefore, I am currently unable to investigate what is precisely the number comparison that causes the request to crash. Would it be possible for the administrators to send me the uncompiled Lua code of these 3 scripts so I can investigate the problem further?
Reply
#2
We do not share the source code, but you can provide a backup of your project so this issue can be investigated further.
Reply
#3
I will send you the backup by private message in a few minutes.

The thing is, I tried to export a backup of the project and to restore it onto another Logic Machine. After doing that, the same request on the new machine worked properly. Therefore the problem doesn't seem to be reproducible.
Reply
#4
Do you have the latest 2021 firmware on both devices?
Reply
#5
The faulty device is very old, I think it's a LM3. Its firmware is 20170601. We can't securely update its firmware, because it's installed in a customer's building 500 km away from our office, and if the device doesn't reboot properly after the firmware update, we can't afford to go there to fix the problem.
Reply
#6
Then it's related to an old firmware on that device. If I remember correctly this is related to the "10. 3 byte time / day" data type objects. A possible work-around is to enable "Allow only exported objects" in Remote services and remove the "Export" mark for "10. 3 byte time / day" objects.
Reply
#7
Ok, thanks for your reply, I will try this workaround.
Reply


Forum Jump: