jean-emmanuel / open-stage-control

Libre and modular OSC / MIDI controller
https://openstagecontrol.ammd.net
GNU General Public License v3.0
720 stars 91 forks source link

[Bug] Parsing error when opening a .json file #556

Closed cyberic99 closed 5 years ago

cyberic99 commented 5 years ago

Hi

I realized I reported an issue on the discourse (https://openstagecontrol.discourse.group/t/parsing-error-when-opening-a-file/208), maybe here is a better place:

I have a json file that I saved in o-s-c, that produces a parsing error when I try to open it. I tried to simplify it it while still keeping the parsing error.

The error is due to line 242.

I know that I am using values in a matrix, and that these values could be uninitialized on loading.

I already enclosed the calculations in a try/catch block, but node still crashes.

What would the correct way to prevent the crash?

thx

The error:

App available at http://…

[Renderer process error] Uncaught NotFoundError: Failed to execute ‘replaceChild’ on ‘Node’: The node to be replaced is not a child of this node. at updateWidget (src/client/app/editor/data-workers.js:106:35) at reCreateWidget (src/client/app/widgets/common/widget.js:927:15) at changedProps.push (src/client/app/widgets/common/widget.js:709:24) at this.updateLinkedPropsWithNesting (src/client/app/widgets/common/widget.js:381:17) at linkedValueChangedCallback (src/client/app/widgets/common/widget.js:346:21) at this._listeners[evt].slice (src/client/app/events/event-emitter.js:29:29) at listeners[i] (src/client/app/events/event-emitter.js:35:41) at listeners[i] (src/client/app/events/event-emitter.js:35:41) at listeners[i] (src/client/app/events/event-emitter.js:35:41) at changed (src/client/app/widgets/common/widget.js:220:13)

crashing.json.zip

jean-emmanuel commented 5 years ago

J'ai mis en ligne un correctif qui empêche le problème d'arriver. On est là sur un cas assez épineux qui demandera peut-être un changement plus profond à l'avenir pour être mieux traité.

cyberic99 commented 5 years ago

Thanks for you fix @jean-emmanuel.

However, I still get errors when using some /EDIT commands.

Would it be possible to catch these errors and print the widget which caused them?

It would help me (and others) to pinpoint problems more easily

Thanks

jean-emmanuel commented 5 years ago

I've tracked the issue to something deeper than a widget issue, it might take some time to get fixed.

cyberic99 commented 5 years ago

I can also trigger error like these:

[Renderer process error]
Uncaught NotFoundError: Failed to execute 'replaceChild' on 'Node': The node to be replaced is not a child of this node.
    at updateWidget (src/client/app/editor/data-workers.js:106:35)
    at widgetManager.getWidgetById (src/client/app/remote-control.js:27:12)
    at exec (src/client/app/remote-control.js:239:28)
    at receive (src/client/app/osc.js:38:72)
    at receiveOsc (src/client/app/ipc/callbacks.js:25:12)
    at require (src/client/app/ipc/index.js:57:16)
    at this._listeners[evt].slice (src/client/app/events/event-emitter.js:29:29)
    at Array.isArray (src/client/app/ipc/index.js:140:21)
    at onmessage (src/client/app/ipc/index.js:91:21)
cyberic99 commented 5 years ago

I've tracked the issue to something deeper than a widget issue, it might take some time to get fixed.

allright. Maybe my /EDITs are a bit too rough... ?

cyberic99 commented 5 years ago

If I can help in any way or if you want some repro cases, tell me

jean-emmanuel commented 5 years ago

I found and fixed the bug, can you try the patch ?

cyberic99 commented 5 years ago

I tried the latest git and I don't have the error anymore.

However, something (else?) is definitely broken. My dashboard matrices are all empty.

With this session file:

idx.json.zip

at commit 54403a7db80487bf1154d3699025c7a1f2218ab4:

image

at commit 34d740b2d98c4903da59c91e58c3f1e5e889852f:

image

It seems that arrays start at 1 now, instead of 0 before?

Maybe it is because of the deps bump that happened a few commits ago?

the widget in the session just contains this in value:

#{
[1,2][0]
}

Sorry, I have no time right now to see search exactly when the behaviour changed...

jean-emmanuel commented 5 years ago

Hmm, it's very likely to be cause indeed !

jean-emmanuel commented 5 years ago

I have downgraded mathjs to prevent this.

cyberic99 commented 5 years ago

Wow that was a big breaking change! I failed to find any mention of it in the changelog

I'll retest with your last commit, soon

jean-emmanuel commented 5 years ago

It wasn't documented because it was a bug ;).

cyberic99 commented 5 years ago

It wasn't documented because it was a bug ;).

you mean, a bug in mathjs ?

jean-emmanuel commented 5 years ago

No, a bug in o-s-c caused by upgrading mathjs. The root cause however is that mathjs somehow changed the way matrix/array indexing are configured.

cyberic99 commented 5 years ago

OK.

Back to the issue, the error I got has disappeared now, everything is working smoothly, thanks!

I'll do more tests and keep you updated if I find something.

Thanks! (and I'll add 1 or 2 feature requests ;-))