ls1intum / Artemis

Artemis - Interactive Learning with Automated Feedback
https://docs.artemis.cit.tum.de
MIT License
479 stars 286 forks source link

`Modeling exercises`: Apollon freezes locally #9032

Open FelixTJDietrich opened 1 month ago

FelixTJDietrich commented 1 month ago

Describe the bug

In some diagrams, like BPMN and Component Diagrams, when dragging some elements on the canvas the browser freezes and then crashes.

To Reproduce

This issue only appears to exist in the development environment:

  1. Go to 'Create modeling exercise'
  2. Click on 'Class Diagram' and change to 'Component Diagram'
  3. Scroll up to 'Solution Diagram'
  4. Drag a component onto the canvas
  5. ...
  6. Crash

Expected behavior

No crash

Screenshots

No response

Which version of Artemis are you seeing the problem on?

7.4.2

What browsers are you seeing the problem on?

Chrome

Additional context

No response

Relevant log output

No response

FelixTJDietrich commented 1 month ago

I debugged for a really long time. I used Apollon as a local dependency for Artemis and could put breakpoints in the React code (tsx) using the browser's debugging tools.

There is an infinite loop in ./droppable/droppable.tsx, the owner is a uuid for two calls and then it is undefined, maybe that has to do something with the issue. @LeonWehrhahn also has problems with it and we are somewhat out of ideas.

@matthiaslehnertum, @loreanvictor do you have an idea?

FelixTJDietrich commented 2 weeks ago

@loreanvictor sent me another insight which might be helpful:

So I played around with the issue, and the main issue is the erroneous element ID being passed around. This is not specific to diagram type and happens for any element that is a container (e.g. Package elements on the Class Diagrams). I couldn’t figure out why this happens under the circumstances, and also handling the undefined ID gracefully requires a lot of changes across Apollon, which doesn’t seem like the correct approach for an issue that at least right now is not critical.

I suspect someone who understands the component composition of Apollon better might be able to find something more?

It is a peculiar issue as also I couldn’t find any way to reproduce it on Apollon itself.

FelixTJDietrich commented 2 weeks ago

I think the problem is fixable by using the signal-based change detection? This issue of causing infinite rerenders, is somehow related to the current change detection.