Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite loops in /api/rest/projects/{projectId}/commits/{commitId}/roots and /api/.../elements response generation #4459

Open
4 tasks done
ctmbl opened this issue Jan 23, 2025 · 0 comments

Comments

@ctmbl
Copy link

ctmbl commented Jan 23, 2025

originally posted as a comment of #4414


  • I have checked that this bug has not yet been reported by someone else
  • I have checked that this bug appears on Chrome
  • I have specified the version :
  • I have specified my environment :
  • WSL

Screenshots

...

Steps to reproduce

  • create a Blank Studio with a simple Entity containing itself:
    Image
  • access http://localhost:8080/api/rest/projects/<your-project-id>/commits/<your-project-id>/roots

OR

  • create a new project from the Flow template
  • access http://localhost:8080/api/rest/projects/<your-project-id>/commits/<your-project-id>/roots

Expected behavior

  • don't create an infinite loop in the backend => don't reach nesting limit
  • return valid JSON
  • don't return duplicated elements in the JSON (cf example below with standard and Processor1 from the Flow template through target -> incomingFlows -> target)

Actual behavior

/api/rest/projects/{projectId}/commits/{commitId}/roots and /api/rest/projects/{projectId}/commits/{commitId}/elements suffers from infinite loop and return not valid JSON because of a nesting depth limit reached in the backend:

2025-01-16T11:52:22.259+01:00  WARN 4604 --- [io-8080-exec-10] .w.s.m.s.DefaultHandlerExceptionResolver : Ignoring exception, response committed already: org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: Document nesting depth (1001) exceeds the maximum allowed (1000, from `StreamWriteConstraints.getMaxNestingDepth()`)
2025-01-16T11:52:22.259+01:00  WARN 4604 --- [io-8080-exec-10] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: Document nesting depth (1001) exceeds the maximum allowed (1000, from `StreamWriteConstraints.getMaxNestingDepth()`)]

returning (in the case of the Flow template):

[
    {
        "consumption": 0,
        "powerStatus": "NONE",
        "status": "ACTIVE",
        "usage": "UNUSED",
        "outgoingFlows": [],
        "name": "NewSystem",
        "elements": [
            {
                "consumption": 0,
                "powerStatus": "NONE",
                "status": "ACTIVE",
                "usage": "UNUSED",
                "outgoingFlows": [],
                "name": "CompositeProcessor1",
                "elements": [
                    {
                        "status": "ACTIVE",
                        "usage": "UNUSED",
                        "incomingFlows": [
                            {
                                "status": "ACTIVE",
                                "usage": "STANDARD",
                                "capacity": 6,
                                "load": 6,
                                "target": {
                                    "status": "ACTIVE",
                                    "usage": "UNUSED",
                                    "incomingFlows": [
                                        {
                                            "status": "ACTIVE",
                                            "usage": "STANDARD",
                                            "capacity": 6,
                                            "load": 6,
                                            "target": {
                                                "status": "ACTIVE",
                                                "usage": "UNUSED",
                                                "incomingFlows": [
                                                    {
                                                        "status": "ACTIVE",
                                                        "usage": "STANDARD",
                                                        "capacity": 6,
                                                        "load": 6,
                                                        "target": {
                                                            "status": "ACTIVE",
                                                            "usage": "UNUSED",
                                                            "incomingFlows": [
                                                                {
                                                                    "status": "ACTIVE",
                                                                    "usage": "STANDARD",
                                                                    "capacity": 6,
                                                                    "load": 6,
                                                                    "target": {
... (goes on and on through target -> incomingFlows -> target)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant