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

Reply
 
Thread Tools Display Modes
Old 02-15-2022, 04:50 PM   #1
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,102
Default REAPER freezes with ExecProcess loop on Apple M1 (stdout issue) (FIXED)

Hi,


REAPER v6.47, Apple Mac M-1, (repro made on 3 different M-1, not reproducible on Intel mac and Windows)



I able able to make REAPER freeze forever (or at least for every long time) with a simple loop ExecProcess call.


The problem occurs when the ExecProcess return message are long. It seems that the memory used by this messages isn't cleaned in between each ExecProcess call from a script. No matter if the function is defer or not, it will hang at some point.



Here my test code:


Code:
  function RunCommand( str )
   if OS == "Win64" or OS == "Win32" then
     str = 'cmd.exe /C "' .. str .. '"'
   else
     str = '/bin/sh -c "' .. str .. '"'
   end
   return reaper.ExecProcess( str, 0 ):sub(3)
 end
 ​
 command = "'/opt/homebrew/bin/aubiopitch' '/Users/apple/Desktop/Souz-L (17)_12 render 016.wav' -p yinfast -s -90 -l 0.2 -B 4096 -H 512 -u cent"
 ​
 ​
 for i = 0, 500 do
   a = RunCommand( command )
 end

You can install aubio from Homebrew for testing and test on a 5s audio file, or replace aubio by any command which would output lots of data.
Loop 20 times was good, 80 was stuck forever.




sockmonkey who kindly and patiently helped me debug figured out redirecingt stdout and stderr to /dev/null" make it doesn't hand anymore.


It is just adding this at end of the command:

Code:
>/dev/null 2>&1

I think the limit is machine dependent but I'm not sure, but it seems fixed by machine (the script started to crash each time at the same loop iteration).


It is kinda complex to explain all this, so let me know if you need more infos / details.



Thanks for taking a look !

Last edited by X-Raym; 02-20-2022 at 04:17 AM.
X-Raym is offline   Reply With Quote
Old 02-16-2022, 01:57 AM   #2
sockmonkey72
Human being with feelings
 
sockmonkey72's Avatar
 
Join Date: Sep 2021
Location: Berlin
Posts: 1,354
Default

Just jumping in to clarify a couple of things that we tried:
  • deferring the loop [FAIL]
  • deferring each iteration after completion of the previous iteration [FAIL]
  • running the same command, looped via shell script in the Terminal [SUCCESS]
  • using the same code to run a command without output (sleep, for instance) [SUCCESS]
  • redirecting stderr to /dev/null [FAIL]
  • redirecting stdout and stderr to /dev/null [SUCCESS]

The only thing not tried (so far, AFAIK) is using something like os.execute() in lua to do this.

Without knowing the internals of reaper.ExecProcess(), it's hard to speculate what could be going wrong, but it does feel like there's some buffer overflowing after some arbitrary limit.
sockmonkey72 is offline   Reply With Quote
Old 02-16-2022, 05:12 AM   #3
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 14,239
Default

How long is the output of that command?
schwa is offline   Reply With Quote
Old 02-16-2022, 05:20 AM   #4
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,102
Default

Here is a log output of our test file:


https://gist.github.com/X-Raym/846d6...9ed64adfe55673


(this one is way longer than 5s by the way, so make reaper crash more easily)

In this case, 55889 characters, 57.5 KB; for 3001 lines.

Last edited by X-Raym; 02-16-2022 at 05:25 AM.
X-Raym is offline   Reply With Quote
Old 02-16-2022, 06:16 AM   #5
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 14,239
Default

[edit] I can reproduce this, looking into it.
schwa is offline   Reply With Quote
Old 02-16-2022, 11:46 AM   #6
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,403
Default

Sorry to hijack the thread but since you are there, I have managed many times in the past to break ExecProcess on Windows.. If you pass it 5-6 times a wrong command, then it breaks and does not work again, even if you pass it the correct one, until you restart Reaper...
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 02-16-2022, 11:49 AM   #7
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,102
Default

@amagalma
This would deserve a custom thread indeed :P
For sure, you can prepare code for testing!



@schwa
Thanks for working on this!
X-Raym is offline   Reply With Quote
Old 02-16-2022, 12:27 PM   #8
sockmonkey72
Human being with feelings
 
sockmonkey72's Avatar
 
Join Date: Sep 2021
Location: Berlin
Posts: 1,354
Default

Quote:
Originally Posted by X-Raym View Post
@schwa
Thanks for working on this!
Ditto!
sockmonkey72 is offline   Reply With Quote
Old 02-20-2022, 04:18 AM   #9
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,102
Default

Seems solved in v6.48 according to the M1 user who has this issue. Many thx!
X-Raym 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:06 AM.


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