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

Random "Index Out of range" crash in FloatPlot #69

Open
lucarocchi opened this issue Dec 11, 2022 · 6 comments
Open

Random "Index Out of range" crash in FloatPlot #69

lucarocchi opened this issue Dec 11, 2022 · 6 comments
Labels
bug Something isn't working

Comments

@lucarocchi
Copy link

macOS Version(s) Used to Build

macOS 13 Ventura, macOS 12 Monterey

Xcode Version(s)

Xcode 14

Description

I'm working on an iOS app that uses NodeOutputView
Randomly I get this "Index Out of range" as you can see in the screen shot

Crash Logs, Screenshots or Other Attachments (if applicable)

Screenshot 2022-12-10 alle 19 24 32

Screenshot 2022-12-07 alle 17 41 54

@lucarocchi lucarocchi added the bug Something isn't working label Dec 11, 2022
@NickCulbertson
Copy link
Member

My guess would be that samples[j + 1] is out of range. It would be helpful to put

print("samples")
print(samples.count)
print(j+i)
print("resampled")
print(resampled.count)
print(i)

before that line to see if that is the crash. Can you make a simple example project to recreate the issue?

@NickCulbertson
Copy link
Member

samples[min(j + 1, samples.count)] might work if the index is too high, but I'm not really sure what that line is doing.

@emurray2
Copy link
Member

emurray2 commented Jan 3, 2023

Quoted reply

macOS Version(s) Used to Build

macOS 13 Ventura, macOS 12 Monterey

Xcode Version(s)

Xcode 14

Description

I'm working on an iOS app that uses NodeOutputView
Randomly I get this "Index Out of range" as you can see in the screen shot

Crash Logs, Screenshots or Other Attachments (if applicable)

Screenshot 2022-12-10 alle 19 24 32 Screenshot 2022-12-07 alle 17 41 54
It's difficult to debug this without knowing the size of `bufferSampleCount`, but everything else looks fine.

Try following the stack trace in the debugger. Xcode will show the error on every instruction leading up to where the error actually occurred.

If you can pin it down to happening on a line of code involving NodeOutputView, I also recommend writing an example to demonstrate the bug as Nick mentioned.

Edit: Looking at this with a fresh set of eyes, now I can see how this involves FloatPlot on line 115. Going to see if I can investigate further when I get another chance. Where are the samples coming from? I'm guessing some sort of Node?

@emurray2 emurray2 changed the title Random "Index Out of range" crash in NodeOutputView Random "Index Out of range" crash in FloatPlot Jan 4, 2023
@JonL-iOS
Copy link

JonL-iOS commented Jan 6, 2023

I have experienced this bug as well. I use NodeOutputView, and sometimes it would crash with an error similar to the above.

@emurray2, I saw you asking about buffer size...I noticed that for NodeOutputView, the default buffer is 1024. I had been using a buffer of 150. I'm still testing, but so far It seems that changing the buffer to 1024 has eliminated the crashes.

@lucarocchi
Copy link
Author

I don't think buffer size matters i have experienced it also with default buffer size or 2048

@emurray2
Copy link
Member

emurray2 commented Jan 6, 2023

I don't think buffer size matters i have experienced it also with default buffer size or 2048

What I've noticed when I got this error is the node I was using was not stereo, and I was trying to access a buffer which was not there.

You may want to double check the node format or wherever the data inside FloatPlot is coming from.

But definitely make an example project if you can with 1 node and the FloatPlot demonstrating the bug. You could even try using different nodes and see if you get the same effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants