Scotfleiger Posted June 27, 2017 Report Posted June 27, 2017 Hi Pete I have started to see a repeating LUA Error Invalid Argument when running LINDA LUA code to start a second module using the LUA function ipc.runlua(path) (where path is \linda\system\init). 944344 LUA.1: LINDA:: [START] Path = linda/system/init 944625 LUA: "C:\FSX\Modules\linda/system/init.lua": killed 944860 *** LUA Error: cannot open : Invalid argument 1001125 LUA: "linda.lua": killed 1001125 LUA.0: [START] *********************** STARTING LINDA *********************** This could come down to sequencing where the ipc.runlua() is being caused before FSUIPC has actioned the LauKill() function although the kill command is passed before the run command. It appears that the kill command is being delayed. The LuaKill is called from the LINDA GUI followed by a RunLua(linda). Linda.lua calls the following (executed via the GUI) to FSUIPC: path = ipc.get("PATH_SYS") .. "init" where PATH_SYS = linda/system/ if file_exists(path .. '.lua') then ipc.runlua(path) else _log('[START] Unable to find INIT.LUA - Try Restarting') end When the restart is run a second time init.lua is dead and there is no error. We are seeing with 4.964, 4.968 and 5.103. Has anything change in recently? What delay should be built in to ensure the first command is completed before the second is sent? We have not seen this problem until the last month or so. It is only now that I have pinned down the cause. FSUIPC4.log-Invalid Argment.txt FSUIPC4 .log-Invalid Argument2
Pete Dowson Posted June 27, 2017 Report Posted June 27, 2017 18 minutes ago, Scotfleiger said: This could come down to sequencing where the ipc.runlua() is being caused before FSUIPC has actioned the LauKill() function Whether a Lua thread is running or not shouldn't prevent RunLua finding the file. Or are you saying it gets loaded then killed? Why are you killing it before RunLua in any case? Running the same Lua again automatically kills the previous edition. You should leave it all to FSUIPC. There's no relation in the timing between the KillLua in one thread and any other threads or "RunLua" action. You cannot predict the order with separate threads -- it depends on Windows threading, loading, processor usage, hyperthreading, etc. 22 minutes ago, Scotfleiger said: We are seeing with 4.964, 4.968 and 5.103. Has anything change in recently? Nothing in any of that. In any case you mention 4.964 from long ago. BTW 4.968 is superseded by 4.969. Pete
Scotfleiger Posted June 27, 2017 Author Report Posted June 27, 2017 Hi Pete Thank you for your prompt reply. I have removed the LuaKill calls as you recommend but I am still getting the Invalid Argument LUA error when calling RunLua(). It does not happen every time I restart the LUA threads (linda.lua and init.lua) but 1 in 2 or 1 in 3 times. Tests run with 4.969. FSUIPC4.log-KillLuaRemoved.txt
Pete Dowson Posted June 27, 2017 Report Posted June 27, 2017 I'm out this afternoon, so this is from my iPhone. I'll be brief. You said it occurs with 4.964 too. So it must have been happening for many weeks. Or have you changed something to bring it on? It looks odd having that Error line with no Lua line number. Is the report from FSUIPC or your code? Pete
Scotfleiger Posted June 27, 2017 Author Report Posted June 27, 2017 The logs are from fsuipc4. Nothing in the LINDA code has changed (except the removal of the luakill commands you advised). It has been occurring while I was working on getting LINDA working with FSUIPC5 when I was performing multiple LUA restarts (from my GUI) as I tested. However, when I returned to my development system (with 4.964) I could see it happening and was able to isolate the cause to the runlua() command. I also installed 4.969 on the development system and am running 5.103. It is occurring in all cases.
Pete Dowson Posted June 27, 2017 Report Posted June 27, 2017 Ok Can you create a small Lua which recreates the symptom? Lua files aren't kept open, so access whilst the previous incarnation is active can't be the cause. When I get back I'll see what can give rise to that error, and add more logging if necessary. "Invalid parameter " doesn't mean any sort of file access problem unless the path is crazy -- i.e. not even recognisable as a path. I'll leave further responses till I get back -- it isn't easy for me on a phone! Pete
Pete Dowson Posted June 27, 2017 Report Posted June 27, 2017 4 hours ago, Scotfleiger said: 944860 *** LUA Error: cannot open : Invalid argument I've searched the complete source, and the only "Invalid Argument" error using built-in messages only occurs with WideServer, and Windows socket errors. The latter from the original Lua code. The *** ERROR message is produced by FSUIPC when it receives an error from the Lua code, and the part of the message which explains the error is actually supplied by Lua -- I think it might get the bfull error data from Windows, which has a function to do that given the error number. For "runlua" the *** ERROR can only occur when it calls Lua code to "loadfile", and the only parameter is the path. So something seems to go wrong with the path occasinally on repeats. The full path os made up of the FSUIPC path (i.e. the Modules folder, plus what you add to it. I can log that, but it seems to me that it would be far more productive if I could reproduce the error here so I could track to down to te actual error within the Lua code (i.e. the code that isn't actually mine). So, do you think you can provide anything? Pete
Scotfleiger Posted June 27, 2017 Author Report Posted June 27, 2017 I get back to you later with a smaller test.
Scotfleiger Posted June 27, 2017 Author Report Posted June 27, 2017 Hi Pete I have produced a stripped out version of the key .lua code (linda.lua and init.lua) which will enter a repeating loop when ipcReady.lua is called on FSX start. Copy files and folders into \modules directory. I have had it running for some time and, unfortunately, it is not producing the invalid argument error. I will dig deeper. I was wondering whether the mix of forward and backward slashes in the file address has something to do with it. I can only suggest that you try the full LINDA 3.0.0 with the Console open. The LUA Engine can be restarted by the hotkey (CTRL+ALT+R) as required. If you see the error as a red highlighted line. LuaRunTest.zip
Pete Dowson Posted June 27, 2017 Report Posted June 27, 2017 2 hours ago, Scotfleiger said: I was wondering whether the mix of forward and backward slashes in the file address has something to do with it. I was going to ask how that arises. I thought \ was used in paths whilst / is used in URLs. Though it shouldn't work some times and not others either way. 2 hours ago, Scotfleiger said: I have had it running for some time and, unfortunately, it is not producing the invalid argument error. I will dig deeper. Seems odd -- someting more complex than it appears on the surface then. 2 hours ago, Scotfleiger said: I can only suggest that you try the full LINDA 3.0.0 with the Console open. The LUA Engine can be restarted by the hotkey (CTRL+ALT+R) as required. If you see the error as a red highlighted line. I'll try and fit it in tomorrow. Pete
Pete Dowson Posted June 28, 2017 Report Posted June 28, 2017 14 hours ago, Scotfleiger said: I can only suggest that you try the full LINDA 3.0.0 with the Console open. The LUA Engine can be restarted by the hotkey (CTRL+ALT+R) as required. If you see the error as a red highlighted line. Questions about this. I've installed LINDA 3.0.0 (did it not happen with the earlier one you gave me?): Why do I need to see a red highlighted line in the LINDA console? You said the error is an FSUIPC reported one so it should appear in the FSUIPC log, shouldn't it? Do I have to do the restart many times to generate the error? Pete
Scotfleiger Posted June 28, 2017 Author Report Posted June 28, 2017 18 minutes ago, Pete Dowson said: Questions about this. I've installed LINDA 3.0.0 (did it not happen with the earlier one you gave me?): Why do I need to see a red highlighted line in the LINDA console? You said the error is an FSUIPC reported one so it should appear in the FSUIPC log, shouldn't it? Do I have to do the restart many times to generate the error? The problem affects both versions you have. The latest beta build is the one I am working with. The LINDA Console (Verbose logging) is a repeat of what is logged in FSUIPCx.log but is displayed in real time so you can see the error after a restart (CTRL+ALT+R). Every second or third restart should highlight the error. The subsequent restart should run ok (through to "Ready to go, Captain").
Pete Dowson Posted June 28, 2017 Report Posted June 28, 2017 6 minutes ago, Scotfleiger said: The LINDA Console (Verbose logging) is a repeat of what is logged in FSUIPCx.log but is displayed in real time Same as the FSUIPC Console log then. 6 minutes ago, Scotfleiger said: Every second or third restart should highlight the error. The subsequent restart should run ok (through to "Ready to go, Captain"). I must have done between 10 and 20 restarts, everyone the same, no error reported. Where is "Ready to go" displayed? I wasn't watching the P3D screen. Should I have been? Do I have to wait a while after each restart? I searched the FSUIPC4 log after closing P3D. The only error, in one of the restarts, was this: 224345 *** LUA Error: E:\Prepar3D v4\Modules\linda/system/init.lua:118: module '0lib-aivlasoft' not found: Odd that it occurred just the once. I've just counted the occurences of "beginning "E:\Prepar3D v4\Modules\linda/system/init.lua"" -- 15 restarts, with just that one error above. Sorry, but I need to reproduce it to find it. Can you log the actual "argument" being used for each Open, Load or Run request? Or shall I try and locate the place within the Lua where the Open error is being diagnosed, and log the reason in more detail there? Pete
Scotfleiger Posted June 28, 2017 Author Report Posted June 28, 2017 Hi Pete Interesting as Guenseli has also reported the problem. Do you have a Flt Sim running? This is needed to 'load' the restart process. The pathname listed immediately below 'Aircraft module detected:' and 'Calling Initialisation...' contains the argument ("Path =linda/system/init") used in RunLua(path). The error seen (module not found) is a corrupted read of a file name. I will look at that.
Pete Dowson Posted June 28, 2017 Report Posted June 28, 2017 23 hours ago, Scotfleiger said: 944625 LUA: "C:\FSX\Modules\linda/system/init.lua": killed 944860 *** LUA Error: cannot open : Invalid argument Referring to the above, from your first meassage, I note there's a gap of 235 mSecs between the Kill and the Error. I've searched the complete source of both FSUIPC itself and the built-in Lua code. There is no errors message starting "cannot open" except in the LFS (file system) library where the code it is in is actually not included unless the system is not a "WIN32" one -- which all Windows systems are these days (even if supporting 64 bit too -- even all the 64 bit Windows API DLLs have "32" in the names. In any case the format of the non-included "cannot open" message is "cannot open <path>: <windows reported error for the error number>", so not like the one you are seeing. Might Linda be invoking external Lua interpretation somewhere? I see two DLLs in the Linda\Lua subfolder -- lus5.1.dll and lua51.dll. Could they be involved? Since I seem unable to track down where to put any specific logging I don't think i can proceed to help without being able to reproduce it. Pete
Pete Dowson Posted June 28, 2017 Report Posted June 28, 2017 17 minutes ago, Scotfleiger said: Do you have a Flt Sim running? This is needed to 'load' the restart process. Sorry, how does FSUIPC load LINDA with no flight simulator running? I don't get the question. Please see my previous messge, which seems to have overlapped with yours. Pete
Scotfleiger Posted June 28, 2017 Author Report Posted June 28, 2017 Just now, Pete Dowson said: Sorry, how does FSUIPC load LINDA with no flight simulator running? I don't get the question. There are 2 elements to LINDA. The GUI (LINDA.EXE) which is started manually or via the entry in [Programs] block of FSUIPCx.ini. GUI actions can be carried out with the flight sim running. The LAU element is triggered by the ipcReady.lua file which calls \modules\linda.lua which in turn runs \modules\linda\system\init.lua. A restart is also triggered on load a new aircraft or scenario. Sorry for the confusion. The LUAxx.dll are used by the LINDA Editor only. The 2 files is how I inherited the code - I leave it well alone. Thank you for your efforts. Please don't waste any further effort. I can handle the issue by forcing a second restart if I detect the invalid argument error.
Pete Dowson Posted June 28, 2017 Report Posted June 28, 2017 13 minutes ago, Scotfleiger said: There are 2 elements to LINDA. The GUI (LINDA.EXE) which is started manually or via the entry in [Programs] block of FSUIPCx.ini. GUI actions can be carried out with the flight sim running. Yes, but why would I want to restart LINDA in FS without FS running? Makes no sense to me still, sorry. 14 minutes ago, Scotfleiger said: Please don't waste any further effort. I can handle the issue by forcing a second restart if I detect the invalid argument error. Well, I might indeed have to release an interim update without first fixing this*, but I don't like leaving it. It needs tracking down. I've made a test version which should log the actual argument and the Windows error number returned at the actual place where the file is opened. Lua code uses a C/C++ run-time library function (fopen) rather than the CreateFile Windows API function I always use, so there's another layer of code involved, but that shouldn't matter. I'll provide the test version via email if you don't mind. Please send me an email i can respond to. Pete * The need for an Interim release is mainly to get the Goflight facilities properly tested by others. Goflight have now supplied me with a GFDev64.dll which works well, and I've tested it thoroughly here, but only with RP48, T8 and P8 units, the only ones I have left.
Scotfleiger Posted June 28, 2017 Author Report Posted June 28, 2017 1 minute ago, Pete Dowson said: Yes, but why would I want to restart LINDA in FS without FS running? Makes no sense to me still, sorry. Sorry for the conclusion. When I have been talking about LINDA restart, I mean the LUA restarting only. This is to load the modules for different aircraft, changes in device assignments/configuration, to overcome other issues or, in my case, to reload edited code for testing purposes. Most users do not need to restart unless they hit a problem. 5 minutes ago, Pete Dowson said: I'll provide the test version via email if you don't mind. Please send me an email i can respond to. Send to linda@awginfosys.net please.
Pete Dowson Posted June 28, 2017 Report Posted June 28, 2017 1 hour ago, Scotfleiger said: The pathname listed immediately below 'Aircraft module detected:' and 'Calling Initialisation...' contains the argument ("Path =linda/system/init") used in RunLua(path). I'm not getting those lines. I see LINDA reporting: 175126 LUA.1: LINDA:: [START] Loading System Configuration files 175142 LUA.1: LINDA:: [START] WARNING - All LUA logging switched off !!! 175142 LUA.1: LINDA:: [START] Go to Setup LINDA to switch on (if required) And I've gone to LINDA.exe's "Settings" but see no option for extra logging? Additionally, as I asked before, when and where am I supposed to see the "Ready to go captain" message? Because I've not seen it yet. Maybe it isn't running properly here? I do get "LINDA READY" though. Please also see previous message. Pete
Pete Dowson Posted June 28, 2017 Report Posted June 28, 2017 4 minutes ago, Scotfleiger said: When I have been talking about LINDA restart, I mean the LUA restarting only Using CTRL+ALT+R, as you stated? Please also see previous message which overlapped with yours. Pete
Scotfleiger Posted June 28, 2017 Author Report Posted June 28, 2017 Sorry. You need to open the LINDA Console and select Verbose logging (dropbox at bottom) to see the level of LINDA logging you mention. Alternatively, goto LINDA setup and tick Developer Mode to do the same.
Pete Dowson Posted June 28, 2017 Report Posted June 28, 2017 16 minutes ago, Scotfleiger said: You need to open the LINDA Console and select Verbose logging (dropbox at bottom) Dropbox? Do you mean the three arrows? (I would never have recognised that as a dropbox button!). What about the "Ready to go, Captain" message. When and where is that supposed to happen? [LATER] Oh, only in the Verbose Log. Shouldn't it be a normal message, on the FS screen, or is that the LINDA READY message? Seems they ought to be swapped? Pete
Scotfleiger Posted June 28, 2017 Author Report Posted June 28, 2017 6 minutes ago, Pete Dowson said: Dropbox? Do you mean the three arrows? (I would never have recognised that as a dropbox button!). What about the "Ready to go, Captain" message. When and where is that supposed to happen? I can understand your frustration with users. With the Console open, you need to click on the 3 down arrows to open a lower pane. Here you will find the logging options.
Pete Dowson Posted June 28, 2017 Report Posted June 28, 2017 14 minutes ago, Scotfleiger said: I can understand your frustration with users. Sorry, but the main logging does clearly say: 175142 LUA.1: LINDA:: [START] WARNING - All LUA logging switched off !!! 175142 LUA.1: LINDA:: [START] Go to Setup LINDA to switch on (if required) So naturally I expected it to be in LINDA Setup! Pete
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now