View Full Version : Script Error: Could not aquire Lua Mutex
mhwlng
March 31st, 2007, 05:58 AM
I moved my G5 application from a 2.8Ghz Pentium IV (1GB RAM, XP PRO)
To an 800Mhz transmeta processor (256Mb RAM, XP PRO)
so it is considerably slower (but it uses 15W instead of 300W power, so It will cost me a lot less to run 24/7)
but now I see a lot of these errors when I start girder :
Script Error: Could not aquire Lua Mutex
basically the scripts that give the error start a thread, that does 'stuff'
I start 20 threads or so like this and a lot give this error,
each script is started by FileLoaded/ScriptEnable girder events...
any ideas how I can fix things ?
Marcel
mhwlng
March 31st, 2007, 06:07 AM
additional observation ...
even completely empty (i.e. everything commented out) scripts that are triggered on ScriptEnable/FileLoaded show
Time Date Source Details Payloads
16:12:33:049 3/31/2007 switch on optimus Script Error: Could not aquire Lua Mutex.marcel v2.0.gml:\OPTIMUS\switch on optimus
Marcel
mhwlng
March 31st, 2007, 07:10 AM
adding win.Sleep between 2 and 10(!) seconds to the beginning of each script, gets rid of the error, but that's a pretty nasty solution....:rolleyes:
Marcel
mhwlng
April 3rd, 2007, 10:39 AM
bump....
Marcel
Ron
April 3rd, 2007, 11:41 AM
I cannot reproduce this here. There is something beyond the normal Girder stuff holding on to the lua mutex for an extended period of time....
mhwlng
April 3rd, 2007, 11:47 AM
this PC is very slow.....
on my fast development machine, I didn't see the problem either...
do you have some fixed timeouts in your code somewhere ?
Marcel
Ron
April 3rd, 2007, 11:53 AM
I sure have timeout on acquiring the lua mutex. This is needed to prevent Girder from slowing to a crawl on events for each matching lua action. How slow a pc is that?
danward79
April 3rd, 2007, 11:55 AM
Ron, maybe worth trying it using one of those programs that loads your processor?
Ron
April 3rd, 2007, 11:59 AM
Reading back your message something is funny. The 10 second sleep on a thread should not influence the main lua state. What do you do in the threads after those 10 secs?
mhwlng
April 3rd, 2007, 12:01 PM
How slow a pc is that?
see first post
800Mhz transmeta processor
once girder is started, the girder speed is reasonable (although cpu utilization is on average 50%)
(be happy that I didn't install G5 on a 500Mhz transmeta device that runs w98 :o )
mhwlng
April 3rd, 2007, 12:10 PM
What do you do in the threads after those 10 secs?
a lot of stuff :
I have 16 events that are linked to FileLoaded/ScriptEnable
I start polling 6 weather sources around the world
I start polling several rss news sources
I start xAP
I do a lot of X10 and DM stuff at startup
I start polling one-wire bus stuff
I start calculating world times
I connect to 2 mediabridge instances
I start polling SNMP data
Everything I poll gets stored in an ms-access database for trending
I start polling for BT devices
I start controlling the optimus device
I also have quite a lot of serial ports and various hardware that all need to be initialized at startup :
* treadmill
* caller id modem
* rfxcom
* CM11
* optimus
* 1 wire bus
* BT dongle
* irtrans
Ron
April 3rd, 2007, 01:46 PM
Maybe you can move that to load from the startup directory....
mhwlng
April 3rd, 2007, 01:53 PM
Maybe you can move that to load from the startup directory....
I don't know what you mean by that ?
it's all lua code that runs in girder, not batch files or executables that can be started separately...
Marcel
Ron
April 3rd, 2007, 01:55 PM
instead of running that stuff in Nodes on the tree which is subject to that timeout, use the lua startup directory. Check out the file luascript/startup/test.lua and add to it... calling your own code (now removed from the tree-nodes).
mhwlng
April 3rd, 2007, 01:58 PM
ah, I see...
I'll try that...
Marcel
mhwlng
April 7th, 2007, 01:18 AM
ok, I moved all my initialization stuff out of the tree to the startup folder, and now I don't see these errors anymore...
----
I only see an error symbol with this message :
Time Date Source Details Payloads
11:08:48:012 4/7/2007 Serial Time to open serial devices was 2504.4420450085 ms
should I worry about that or is that normal ?
----
From one of my startup script files, I needed to access your weather class, which wasn't initialised yet.
I added this to the top of my script :
gir.LoadPreCompiledScript(gir.Scripts.WEATHER)
is that the right way to do it ?
----
p.s. it would also be nice, if you could also execute scripts in startup\subdirectory, so that I can put all my stuff in their own subdirectory
Marcel
mhwlng
April 7th, 2007, 02:03 AM
hmmm, it's not quite working yet :rolleyes:
----
I have the scheduler plugin checked,
but I OFTEN (not always) see in the log at startup :
Time Date Source Details Payloads
11:52:27:033 4/7/2007 SunRiseSet Scheduler not loaded.
and I have the sunclock component enabled, and that now shows
...s\Promixis\Girder5\luascript\components\SunCloc k.lua:128: attempt to index global `SunRiseSet' (a nil value)
stack traceback:
...s\Promixis\Girder5\luascript\components\SunCloc k.lua:128: in function <...s\Promixis\Girder5\luascript\components\SunCloc k.lua:96>
...s\Promixis\Girder5\luascript\components\SunCloc k.lua:236: in function `Update'
...s\Promixis\Girder5\luascript\components\SunCloc k.lua:190: in function <...s\Promixis\Girder5\luascript\components\SunCloc k.lua:189>
this is not always the case :
Is this another timeout issue ?
-----
If I do have above problem, then I also can't stop G5 :
if I stop girder, I see the
girder fileclose event
and then nothing happens, I have to kill G5 in the task manager
----
I start girder minimized in the tray ('start hidden')
If I wait a few minutes then I see cpu utilization 100% and double clicking the icon doesn't do anything
if I start girder and double click the icon immediately, the window shows ok after it's done initializing
Marcel
Promixis
April 7th, 2007, 06:57 AM
Marcel,
The next release has moved the sunriseset stuff into a component (along with ambient light). This will fix the script errors and problems with dependencies.
As well, the lock you are seeing below should be fixed (mutex problem in sunclock).
Powered by vBulletin® Version 4.1.8 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.