ossia / libossia

A modern C++, cross-environment distributed object model for creative coding and interaction scoring
https://ossia.io
GNU Lesser General Public License v3.0
204 stars 33 forks source link

[ossia-max] hang when closing and reopening patcher #793

Open evanmtp opened 2 years ago

evanmtp commented 2 years ago

Found this one while testing in relation to #792 . Sometimes when closing and reopening a patcher with ossia objects, Max hangs indefinitely. Force quitting leads to a report with a ton of lines like this:

11 ossia::max_binding::register_children_in_patcher_recursively(object, ossia::max_binding::object_base) + 761 (libossia-max.dylib + 5710345) [0x133f5d209] 1-11

Example report here:

https://gist.github.com/evanmtp/e214f13f71b84803936258af986abb20

Test files: hangtest.zip

Steps to reproduce:

  1. Open _hangtest.maxpat
  2. Close _hangtest.maxpat
  3. Repeat 1 and 2 until Max hangs (usually 5-10 times is sufficient)
avilleret commented 2 years ago

I confirm I can reproduce this hang. according to report, it loops indefinitely in register_children_in_patcher_recursively

jcelerier commented 2 years ago

I'm wondering about the code there : what would you think about:

1/ Making a list of all the subpatchers in a std::vector 2/ applying the operations on that vector in a for-loop ?

Would that break the algorithm too much ?

avilleret commented 2 years ago

I think it is worth refactoring this algo again in light of what we've learned since