lua pro question about io.open freezing Topic is solved

Moderator: leecollings

Post Reply
zicht
Posts: 268
Joined: Sunday 11 May 2014 11:09
Target OS: Windows
Domoticz version: 2023.1+
Location: NL
Contact:

lua pro question about io.open freezing

Post by zicht »

Hi

i recently experience freezing of io.open after some time ( > 60 minutes). My system setup :
ersion: 2024.7 (build 16361)
Build Hash: 41fbd5053
Compile Date: 2024-12-14 08:03:34
dzVents Version: 3.1.8
Python Version: 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:38:17) [MSC v.1932 32 bit (Intel)]
Background :
I have a lot of data gathered thrue windows schedular (curl and headless chrome canary) and stored in a text file. ( about 70 files)
I do this by schedular to avoid freezing domoticz when collecting the data from the web. Of course there are a few running low frequent like once an houre and some every minute. (think about tplink p110 smartplug for example, i use the api outside of domoticz with a python script)

The contents of the text files are read by plain lua -see below- (no dzevents and working from the script dir in domoticz)
I make sure to have it run all at different times to avoid having to much files open for the OS (win10 pro)
System resources are constantly below 80% on an intel core i7- 2620M

i runn a taskkill on schedular every hour to kill ghosts from python and cmd ( using batch files) witch i seem not to can avoid ... i dont understand why python and cmd ghosts exist as the scripts seem to finish correctly

The script function i am using to read the data :

Code: Select all

function readAll(filenaam)
  ok=fileexists(filenaam)
  if ok==true then
	  local f = io.open(filenaam, "rb")
	  content = f:read("*all")
	  f:close()
	  return content
   else
      print(filenaam.." error file does not exist")
      return "error file does not exist"
   end
end
Question:
At this moment i restart domoticz every hour just to keep it working, but it causes a short freeze and thats annoing. I kill the domoticz process by ID and nssm is picking it up very fast to start domoticz again.
  • What could be causing io.open to get unresponsive ?
    and how to avoid the freeze ?
    Is there a smarter way to gather the data from the text files other than io.open ?
any suggestion is welcome ...
Rpi & Win x64. Using : cam's,RFXCom, LaCrosse, RFY, HuE, google, standard Lua, Tasker, Waze traveltime, NLAlert&grip2+,curtains, vacuum, audioreceiver, smart-heating&cooling + many more (= automate all repetitive simple tasks)
zicht
Posts: 268
Joined: Sunday 11 May 2014 11:09
Target OS: Windows
Domoticz version: 2023.1+
Location: NL
Contact:

Re: lua pro question about io.open freezing

Post by zicht »

Solved, seems to be due to max open files thats significant lower for the lua and c interprenter then for the OS.
Now i have reduced the opened files/pipes and it keeps running
Rpi & Win x64. Using : cam's,RFXCom, LaCrosse, RFY, HuE, google, standard Lua, Tasker, Waze traveltime, NLAlert&grip2+,curtains, vacuum, audioreceiver, smart-heating&cooling + many more (= automate all repetitive simple tasks)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest