Fixed filter banks hang on mac os

Started by j_p_higgins, June 01, 2025, 02:17:42 AM

Previous topic - Next topic

j_p_higgins

There seems to be an intermittent fault where fixed filter banks (FILTER BANK) hang on mac just after printing "INFO: Running Filter" to the console.

Sometimes it will run fine but most of the time it hangs. I have recreated this bug in the command line so it seems it is an issue with the cdp process itself. I have tried troubleshooting in lldb but it is just giving me exit code -1 and nothing else useful. I have had reports of this happening on M macs and intel macs so it doesn't seem like it is arm mac specific.

On my most recent test it was hanging on most runs with most arguments but the last run it hung on I was calling:

filter bank 1 infile outfile 400 1.5 55 12000

The infile was a stereo wav.

There are some crash reports in this link: https://github.com/j-p-higgins/SoundThread/issues/75 although they seem to suggest the problem is with calling display_virtual_time however commenting out calls to that in the filter code and building the source didn't seem to make any difference

Is here the right place to report this or should I open an issue on github?

j_p_higgins

I've spent some time trying to troubleshoot this although my knowledge of C is pretty poor so I'm not doing the best job. I have no fixes yet but in case anyone looks into this, this is what I have found/tried:

  • From inserting some diagnostic prints in the code, it is getting as far as the main processing loop after the normalisation stage and "Info: Running Filter" however, it just loops for ever. On the first loop it reports to have processed some samples but the value of samps_left doesn't go down and after the first loop it just remains at this on every loop:

    samps_left: 1830700 | ssampsread: 0 | filter_tail: 0 | tail_extend: 0

    By the time it reaches the file writing stage in loop, sampsread is always 0.
  • This only seems to occur when it is called from the command line. Running this process within SoundLoom directly runs fine however, if I make it part of a batch file inside SoundLoom and run that from the batch window in SoundLoom it gets stuck looping. I did try forcing sloom to 1 in the code to see if that made a difference, it didn't make a difference but I'm not convinced I did it right.
  • It doesn't make any difference if the process runs with the -t or -s flags.
  • I tried forcing the normalisation scaling on the output to something very high in case the tail logic wasn't seeing a high enough level due to rounding but that didn't seem to make a difference.
  • Some users have reported that it runs fine first time after a reboot but not after that however, I haven't been able to replicate this personally.
  • Sometimes if the filter banks maximum frequency is set close to the minimum frequency it will run - mostly only with filter bank 6. I thought this might suggest denormals were the issue but flushing those didn't seem to make a difference.
  • It runs fine on windows, I haven't had a chance to test it on linux yet but I haven't had any reports from linux users of it not working

j_p_higgins

Some progress, the issue is being caused by the normalisation step although both that and the filtering seem to work fine individually. If I bypass normalisation by setting do_norm = 0 the process doesn't get stuck looping. I am not really sure though what is causing it to not get stuck. Some things to note:

  • sndseekEx is returning 0, although I haven't yet checked that it is actually succeeding at all steps
  • reset_filedata_counters doesn't reset ssampsread although manually resetting this to 0 didn't make any difference
  • I have now recreated the bug where it runs first time after a reboot but not any subsequent time, it will also sometimes run correctly if I duplicate the input file and run it again with the new file

I might have to stop trying to troubleshoot this now, I haven't done any programming in C since I was a teenager and this is getting a bit beyond me but hopefully these will be helpful pointers for someone who actually knows what they are doing!