Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPSS~ crashes with even numbered HSize argument #51

Open
tremblap opened this issue May 31, 2022 · 9 comments
Open

HPSS~ crashes with even numbered HSize argument #51

tremblap opened this issue May 31, 2022 · 9 comments
Assignees

Comments

@tremblap
Copy link
Member

recompiling in Test now, but in the meantime, how to reproduce:

  1. open PD ampfeature~ help AND play a file
  2. whilst it is playing, open the hpss~ help

PD crashes. It doesn't happen if you load both then start playing. And it doesn't crash if you just turn DSP on, it's when a file is playing.

@tremblap
Copy link
Member Author

update: one needs to open the hpss help, close it, and open again. then it crashes.

crash report:
Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00007f8997711000
Exception Note: EXC_CORPSE_NOTIFY

Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [15641]

VM Regions Near 0x7f8997711000:
MALLOC_LARGE 00007f8995709000-00007f8997711000 [ 32.0M] rw-/rwx SM=PRV
-->
MALLOC_MEDIUM 00007f8998000000-00007f8998800000 [ 8192K] rw-/rwx SM=PRV

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 fluid.hpss~.pd_darwin 0x0000000109361960 fluid::algorithm::HPSS::init(long, long) + 1088
1 fluid.hpss~.pd_darwin 0x00000001093614e5 void fluid::client::hpss::HPSSClient::process(std::__1::vector<fluid::FluidTensorView<float, 1ul>, std::__1::allocator<fluid::FluidTensorView<float, 1ul> > >&, std::__1::vector<fluid::FluidTensorView<float, 1ul>, std::__1::allocator<fluid::FluidTensorView<float, 1ul> > >&, fluid::client::FluidContext&) + 261
2 fluid.hpss~.pd_darwin 0x00000001093613c3 fluid::client::impl::RealTime<fluid::client::FluidPDWrapper<fluid::client::ClientWrapperfluid::client::hpss::HPSSClient > >::perform(int) + 227
3 fluid.hpss~.pd_darwin 0x00000001093603c9 fluid::client::impl::RealTime<fluid::client::FluidPDWrapper<fluid::client::ClientWrapperfluid::client::hpss::HPSSClient > >::callPerform(long*) + 25
4 pd 0x0000000109039a95 dsp_tick + 37

@tremblap
Copy link
Member Author

this is on nightly of yesterday, and on tip of today: Fluid Corpus Manipulation version 1.0.0-TB2.beta6+sha.0b7a899.core.sha.44635d2c

@weefuzzy
Copy link
Member

luckily it's simpler: you just need to launch hpss~ help with the dsp on

@tremblap
Copy link
Member Author

luckily

:D

@weefuzzy
Copy link
Member

It's the leading argument of 4096 (which is now saying set the hfilter size to 4096) that seems to be the culprit. Obviously that oughtn't cause a crash, because it should be maxing out, but AFAICT the workaround is to get rid of that.

@tremblap
Copy link
Member Author

so should that go in core as a hpss bug?

@weefuzzy
Copy link
Member

No, it could be the wrapper. Leave it here and I'll move if needed when I come to investigate

@weefuzzy weefuzzy changed the title crashing under pressure with specific opening sequence HPSS~ crashes with even numbered HSize argument May 31, 2022
@weefuzzy
Copy link
Member

The problem is that the first argument sets the maximum value for the harmonic filter size, but doesn't take into account that there is also an odd constraint on that value, which works by nudging even numbers up to the next odd. So what happens in the help patch at present (which has an argument of 4096 for maxFFT still) is that the algorithm duly allocates storage for 4096 points and then immediately we read the 4097th because of the rounding.

So, for maxima-setting args like this, they need to go through the same constraints as incoming values to ensure that everything is consistent. Sadly that needs doing in every wrapper as it stands, but seems suitably tedious that I might ship it in to core instead.

@weefuzzy weefuzzy mentioned this issue Jun 8, 2022
@tremblap
Copy link
Member Author

tremblap commented Jun 8, 2022

I think I got the same crash with spectralshape helpfile (it was doing 4096 as argument and removing that argument solved the crash - if not the same bug, I can make another ticket):

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY

Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [21074]

VM Regions Near 0:
-->
__TEXT 0000000101dfa000-0000000101f1a000 [ 1152K] r-x/r-x SM=COW /Applications/Pd-0.52-2.app/Contents/Resources/bin/pd

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_platform.dylib 0x00007fff673e9850 _platform_strcmp + 80
1 pd 0x0000000101e6bd8e dogensym + 126
2 fluid.stats.pd_darwin 0x0000000106d0064e fluid::client::FluidPDWrapper<fluid::client::ClientWrapperfluid::client::runningstats::RunningStatsClient >::makeClass(char const*) + 414 (FluidPDWrapper.hpp:1205)
3 pd 0x0000000101e74d0e sys_do_load_lib + 1054

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants