Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Bug Reports

Reply
 
Thread Tools Display Modes
Old 08-05-2018, 05:03 PM   #1
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default ReaScript Bug that makes Lua hanging...

I've found a bug which hangs Lua for a script that contains the following line:
Code:
  retval, String = reaper.BR_Win32_GetPrivateProfileString("Reaper", nil, "UltraschallNups", IniFile)
I've tested in on Windows 7 with Reaper 5.78 and 5.941 with SWS2.9.7 and SWS 2.9.8(beta).

I had such a behavior in the past with

Code:
reaper.BR_Win32_WritePrivateProfileString("", nil, "", reaper.GetResourcePath().."\reaper.ini")
as well, but that seem to work for quite a while again.

I reported the latter line to SWS a while ago, but CFillion couldn't reproduce it: https://github.com/reaper-oss/sws/issues/956
so maybe, it's a nil-type-conversion problem somewhere in Reaper?

Last edited by Meo-Ada Mespotine; 08-05-2018 at 05:50 PM.
Meo-Ada Mespotine is offline   Reply With Quote
Old 08-05-2018, 05:59 PM   #2
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

No hanging here (Windows 8 x64, Reaper 5.941).

Just to confirm, is the first example the code you're using? If so, it's wrong - should be Section, Key, String (nil), INI.

Why are you trying to read and write nil keys in the INI file anyway?
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 08-05-2018, 06:34 PM   #3
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

This is really odd. Now, that I try the same lines again, they work.

An hour earlier and over the whole day today, I successfully triggered the bug time and again and eventually could bring it down to the nil-parameter-problem.

I even triggered it in 5.78 again a few minutes ago but not in 5.941, where I successfully triggered it before...

For some unknown reasons, this seems not to happen all the time.. O_O


The line I included is just a simplified problematic line. The point in reporting the bug is, that the script should stop always with a error, that I tried to give nil as a parameter, but instead, Lua hangs for that script making the script unrunnable from that point on...
This makes debugging stuff sometimes a nightmare...

Last edited by Meo-Ada Mespotine; 08-05-2018 at 06:51 PM.
Meo-Ada Mespotine is offline   Reply With Quote
Old 08-05-2018, 06:39 PM   #4
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Ok, this is the whole script, that triggered the bug all the time. I tried to write me a script, that checks, if the action-list I dumped with the SWS-dumpactionlist-action, contains new actions in the new Reaper-version.

The script "BuggyScript.lua" is a simplified version. Put it into scripts and put Test.ini
Test.txt into the app-directory of Reaper(I tested it with the portable version).

Run the script and bang: Lua hangs, means, the script can't be run a second time.

http://www.phantastika.org/stuf/BuggyScript.zip

Edit:


Last edited by Meo-Ada Mespotine; 08-05-2018 at 06:49 PM.
Meo-Ada Mespotine is offline   Reply With Quote
Old 08-05-2018, 08:25 PM   #5
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Alright, with that I do get a crash - no hang, just an immediate "Reaper has stopped working".

Next question: Why are you playing around in the app folder? You're probably running into system permission issues, if nothing else, and the files you're looking at don't live there anyway. I think you want reaper.GetResourcePath().
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 08-05-2018, 09:32 PM   #6
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

In portable installations, the App-directory and the resource-directory of Reaper are the same, hence it didn't matter whether I would use reaper.GetExePath() or reaper.GetResourcePath() in my script.

In "standard"-installations you're right, reaper.GetResourcePath() would be the right choice after all.

I'm using tons of portable installations for development and testing different versions of Reaper. Haven't used a "standard"-installation in ages...
Meo-Ada Mespotine is offline   Reply With Quote
Old 08-09-2018, 10:08 AM   #7
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
Default

I was able to get the crash this time. This should prevent it: https://cfillion.ca/files/sws/fix-wi...api-empty-key/.
cfillion is offline   Reply With Quote
Old 08-13-2018, 07:14 AM   #8
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

@cfillion

Thanks for your fix.
Meo-Ada Mespotine is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:36 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.