Sandboxing plugins?

Unlike in modern managed languages like C#, in C++, segmentation faults and memory corruption are inevitable. I just found such a bug:

Is it be possible to isolate each plugin or catch the errors so that just the one plugin crashes, and not the whole Rack? Maybe at least with a “catch(…)” when calling step and process? Of course would be ugly, and should be disabled in dev-mode so that a plugin developer can see the bugs. Or maybe if such an exception happens, a message box could be displayed which plugin caused it, and then it will be disabled, and the plugin author could be informed.

Hm, I guess it’s not that easy and some sort of try-catch won’t help.
I did yesterday an hour long debugging session for one of my modules until I noticed that the problem was another module writing to “my” memory…

Not sure try/catch will catch a seg fault.

These bugs are the worst. How did you find it?

There is a library which can do this:

1 Like

Of course, if another module overwrites memory of my module, and then my module would generate a segmentation fault, it would be bad if my module would get deactivated. But I guess there is no easy way to detect invalid memory writes, which doesn’t crash.

I noticed at some point that one module panel had strange “drawings” on it. After starting a new patch with modules I know solved all my strange problems and crashes…

Ok, I thought you did something magical, like breakpoints on memory change or something like that :slightly_smiling_face: Did you create a github issue for the malfunctioning module?

It is slow and I have barely used it on rack but valgrind will find errors such as this and is super accurate. It was critical in finding bugs in surge.

But is slow.

1 Like