zyn-fusion-issues
zyn-fusion-issues copied to clipboard
Possible memory leak?
Update: The LV2 plugin appeared to be the only affected. Then I just try uninstalling all LV2 plugins but zyn-fusion. And it does not showed more errors or even SIGSEGV. So, another plugin is causing that, not zyn-fusion.
I receive a errors like this:
Warning: failed to load part<>!
corrupted size vs. prev_size in fastbins
Abortado (`core' generado)
munmap_chunk(): invalid pointer
Abortado (`core' generado)
malloc_consolidate(): invalid chunk size
Abortado (`core' generado)
and this:
mxml: Mismatched close tag </POINT> under parent <AMPLITUDE_ENVELOPE> on line 517.
mxml: Mismatched close tag </POINT> under parent <AMPLITUDE_ENVELOPE> on line 69.
mxml: Mismatched close tag </POINT> under parent <AMPLITUDE_ENVELOPE> on line 187.
mxml: Mismatched close tag </POINT> under parent <AMPLITUDE_ENVELOPE> on line 61.
mxml: Mismatched close tag </POINT> under parent <AMPLITUDE_ENVELOPE> on line 61.
mxml: Mismatched close tag </POINT> under parent <AMPLITUDE_ENVELOPE> on line 584.
mxml: Mismatched close tag </POINT> under parent <AMPLITUDE_ENVELOPE> on line 234.
mxml: Mismatched close tag </POINT> under parent <AMPLITUDE_ENVELOPE> on line 292.
mxml: Mismatched close tag </POINT> under parent <AMPLITUDE_ENVELOPE> on line 612.
mxml: Mismatched close tag </POINT> under parent <AMPLITUDE_ENVELOPE> on line 288.
mxml: Mismatched close tag </POINT> under parent <AMPLITUDE_ENVELOPE> on line 62.
mxml: Mismatched close tag </POINT> under parent <AMPLITUDE_ENVELOPE> on line 1120.
mxml: Mismatched close tag </POINT> under parent <AMPLITUDE_ENVELOPE> on line 62.
mxml: Mismatched close tag </POINT> under parent <AMPLITUDE_ENVELOPE> on line 340.
mxml: Mismatched close tag </POINT> under parent <AMPLITUDE_ENVELOPE> on line 62.
mxml: Mismatched close tag </POINT> under parent <AMPLITUDE_ENVELOPE> on line 280.
mxml: Mismatched close tag </POINT> under parent <AMPLITUDE_ENVELOPE> on line 62.
mxml: Mismatched close tag </POINT> under parent <AMPLITUDE_ENVELOPE> on line 130.
mxml: Mismatched close tag </POINT> under parent <AMPLITUDE_ENVELOPE> on line 222.
So there are some mishandling of memory. I just think about mxml library. The xml syntax of the files are OK because the xmlparse command don't show any error.
If there are no XML incorrect syntax, why the plugin tell that there are a "Mismatched close tag"?
Anyway, I deleted the problematic banks but the first error still is there and the SIGSEGV is less frequent but it happens anyway.
And when I delete more banks the message dissapears. I tried a step by step deleting so I can discover the problematic banks but with no luck. Sometimes the message appears and sometimes it does not. And when the message is not there anyway sometimes a SIGSEGV is raised. So there are some more deep problem than just bad banks. And I think it is not the correct behaviour if there are some wrong bank the application just must skip it but not handle badly and corrupt the memory. It can be a security risk too because anyone may go beyond the memory to possible executing arbitrary code from a bank.
So, on some place there are a misuse of a pointer.
Note: The LV2 plugin is the affected not the stand alone program.
For identifying such issues I'd recommend verifying that the problem can be seen in multiple plugin hosts, and then trying to identify the source of the issue with something like valgrind using the jalv host (which tends to be reasonably minimal). Additionally since you've indicated that there may be non-trivial data dependencies I'd recommend valgrind+vgdb to allow for data inspection when the invalid action occurs. I'm guessing that the official valgrind docs have improved by now, but I usually follow some fairly old instructions of my own when setting up vgdb.
Hi, I don't know if I experience this exact same issue, but zyn-fusion v3.0.6 seems to have a memory leak. On my computer, after letting it running in standalone mode for about one week. While lsof on zyn-fusion does not show any external file to make I/O to, iotop shows disk I/O and swapping:
Total DISK READ: 849.54 K/s | Total DISK WRITE: 0.00 B/s
Current DISK READ: 849.54 K/s | Current DISK WRITE: 0.00 B/s
TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND
3100 be/4 jack 144.46 K/s 0.00 B/s 0.67 % 0.00 % zyn-fusion osc.udp:~uiltin --no-hotload
free before killing zyn-fusion:
total used free shared buff/cache available
Mem: 8047516 6673296 131852 291520 1242368 910492
Swap: 15592444 4349604 11242840
free after killing zyn-fusion:
total used free shared buff/cache available
Mem: 8047516 1478100 5292608 288940 1276808 6112356
Swap: 15592444 1706660 13885784
I may be mistaken but zyn-fusion seems to force the kernel to swap a lot.
@sahabia I think you're talking about a different issue. The GUI component keeps an event log which is likely your problem. The original idea behind it was if a user encountered a bug they could get the GUI to record events and they could be played back. The playback is used for automated screenshot collection, but the recording never had serialization code written (IIRC). Of course I could be wrong, but I don't recall any valgrind detectable memory leaks, nor anything weird in terms of mruby leaking memory over time.
Can you build the GUI yourself? If so I can direct you to the right few lines of code needed to clear out old recorded events.
Hi, many thanks for your answer. The Zyn that is running in my studio has been built from source. That would be great if you could help me on this one. Thanks again.
Great. So what happens is the events get recorded as they come in: https://github.com/mruby-zest/mruby-zest-build/blob/master/src/mruby-widget-lib/mrblib/script.rb#L301 Every frame the events for the current frame are processed and things move onto the next frame: https://github.com/mruby-zest/mruby-zest-build/blob/master/src/mruby-widget-lib/mrblib/script.rb#L438
Disabling the recording of events beyond the current frame likely resolves the memory growth. You should be able to do so by commenting out https://github.com/mruby-zest/mruby-zest-build/blob/master/src/mruby-widget-lib/mrblib/ui-event.rb#L35-L37
Are there plans to disable this on master, or at least to add a switch around it?
I currently don't have plans to add any switch or disable, but I'm not really impacted by it. I wouldn't mind the system forgetting events after the current frame as we haven't taken the time to develop the feature (i.e. switching the functionality off rather than wholesale deleting code). It should be easy enough to add back in if we're interested in the future.