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

Bug: fluid.bufstats~ can crash when mixing threads #441

Open
rconstanzo opened this issue Feb 7, 2025 · 0 comments
Open

Bug: fluid.bufstats~ can crash when mixing threads #441

rconstanzo opened this issue Feb 7, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@rconstanzo
Copy link

Please tell us what you were doing! You can include code and files by drag and dropping them into the text area.

It seems that fluid.bufstats~ can insta-crash when it is getting messages from mixed threads, specifically receiving weights in it's right-most inlet in the high-priority thread, while the object is in @blocking 1 and then also receiving buffers upstream from the high-priority thread.

So I think the steps are:

  1. have fluid.bufstats~ @blocking 1
  2. send weights buffer to right inlet from high-priority thread
  3. send buffer into left inlet from high-priority thread

Sometimes this gives an Invalid weights error message (as mentioned below) but other times it will just crash, presumably when read/writing from unsafe memory.

This is happening in the patch outlined in this thread:
https://discourse.flucoma.org/t/creating-a-filter-from-spectral-moments-fluid-spectralshape/

Specifically this version of the patch:
https://discourse.flucoma.org/uploads/short-url/nkoDHX3alGOt8e2sudrKHQsmq3J.zip

The offending abstraction is dk.spectralshapeframe which has three instances of fluid.stats~ in it, and only one of which was having it's @blocking mode updated automatically (I missed the connection when building the patch).

If you run the patch for any amount of time you will see the error messages, and eventually a crash.

Here's a crash report:

bufstats crash.zip

What was the expected result?

Complaining about threading, which it did do as well:

fluid.bufstats~: Invalid weights

But sometimes it would not complain and instead crash.

What was the actual result?

An insta-crash.

What operating system were you using?

Mac

Operating system version

macOS 15.2

FluCoMa Version

1.0.8+sha.0a9327e.core.sha.7dfcc220

@rconstanzo rconstanzo added the bug Something isn't working label Feb 7, 2025
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

1 participant