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

[Console][Monaco] Uncaught Error: console: maximum tokenizer stack size reached: [json_root,root,...] #186765

Closed
sakurai-youhei opened this issue Jun 23, 2024 · 2 comments · Fixed by #188746
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Feature:Console Dev Tools Console Feature Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more

Comments

@sakurai-youhei
Copy link
Member

sakurai-youhei commented Jun 23, 2024

Kibana version: 74a202a

Elasticsearch version: 8.15.0-SNAPSHOT

Server OS version: Linux wsl 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Browser version: Chrome Version 126.0.6478.63 (Official Build) (64-bit)

Browser OS version: Windows 11 10.0.22621 N/A Build 22621

Original install method (e.g. download page, yum, from source, etc.): Build from source

Describe the bug: Uncaught error is shown in the browser's dev tool; this is not observable on 8.14.1.

Steps to reproduce:

  1. Go to Kibana > Dev Tools > Console.
  2. Open the browser's console.
  3. Paste the following content to the left pane with Ctrl+a > Ctrl+v.
Reproducer content
GET /
GET _cluster/settings?include_defaults&flat_settings&filter_path=*.*interval*
PUT _cluster/settings
{
  "persistent": {
    "indices.lifecycle.poll_interval": "10s"
  }
}

GET _cat/${TEST}

PUT _data_stream/test-cold
POST test-cold/_rollover

GET _cat/indices?v&h=
GET _cat/indices/.alerts-observability.threshold.alerts-default,.alerts-default.alerts-default,

GET _cat/indices,aliases

GET _cat/shards/test*?v
"""
index                                    shard prirep state      docs store dataset ip         node
.ds-test-cold-2024.05.20-000002          0     p      STARTED       0  249b    249b 172.19.0.2 839a1677bdab
.ds-test-cold-2024.05.20-000002          0     r      UNASSIGNED                               
restored-.ds-test-cold-2024.05.20-000001 0     p      STARTED       0  289b    289b 172.19.0.2 839a1677bdab
"""

GET restored-.ds-test-cold-2024.05.20-000001/_settings

"""
          "snapshot": {
            "snapshot_name": "2024.05.20-.ds-test-cold-2024.05.20-000001-test-h5yr-_tws6es6biug0uqbw",
            "index_uuid": "8tXgFf_cR2KIMofpj2I7Uw",
            "repository_uuid": "3i3oPavIQZGeYOQzRZajyQ",
            "index_name": ".ds-test-cold-2024.05.20-000001",
            "repository_name": "fs",
            "snapshot_uuid": "3S3CDGZgSh2XQSRO3UTxVA"
          }
"""

DELETE _snapshot/fs/2024.05.20-.ds-test-cold-2024.05.20-000001-test-h5yr-_tws6es6biug0uqbw

POST _ilm/stop

POST restored-.ds-test-cold-2024.05.20-000001/_clone/.ds-test-cold-2024.05.20-000001
{
  "settings": {
    "index.store.type": null,
    "index.recovery.type": null
  }
}

# Check the cloned index & shards
GET _cat/indices/.ds-test-cold-2024.05.20-000001?v
GET _cat/shards/.ds-test-cold-2024.05.20-000001?v

PUT _snapshot/fs/2024.05.20-.ds-test-cold-2024.05.20-000001
{
  "indices": ".ds-test-cold-2024.05.20-000001",
  "ignore_unavailable": false,
  "include_global_state": false
}

# Check the taken snapshot

GET _snapshot/fs/2024.05.20-.ds-test-cold-2024.05.20-000001
"""
      "snapshot": "2024.05.20-.ds-test-cold-2024.05.20-000001",
      "uuid": "GC7xoG1yQN6W5LIUMqCDYA",
"""




PUT _snapshot/fs/temp-snapshot-for-recovery
{
  "indices": "restored-.ds-test-cold-2024.05.20-000001",
  "ignore_unavailable": false,
  "include_global_state": false
}
GET _snapshot/fs/temp-snapshot-for-recovery
"""
      "snapshot": "temp-snapshot-for-recovery",
      "uuid": "NgFDtQMESv2o4BZd0dsP8g",
"""

GET .ds-test-cold-2024.05.20-000002
"""
{
  ".ds-test-cold-2024.05.20-000002": {
    "aliases": {},
    "mappings": {
      "_data_stream_timestamp": {
        "enabled": true
      },
      "properties": {
        "@timestamp": {
          "type": "date"
        }
      }
    },
    "settings": {
      "index": {
        "lifecycle": {
          "name": "test"
        },
        "routing": {
          "allocation": {
            "include": {
              "_tier_preference": "data_hot"
            }
          }
        },
        "hidden": "true",
        "number_of_shards": "1",
        "provided_name": ".ds-test-cold-2024.05.20-000002",
        "creation_date": "1716175738940",
        "priority": "100",
        "number_of_replicas": "1",
        "uuid": "nvldBwt2QxeQzpkrbK69qQ",
        "version": {
          "created": "8503000"
        }
      }
    },
    "data_stream": "test-cold"
  }
}
"""


Expected behavior: No error is shown in the browser's console.

Screenshots (if relevant):

image

Errors in browser console (if relevant):

errors.js:15 Uncaught Error: console: maximum tokenizer stack size reached: [json_root,root,...]

Error: console: maximum tokenizer stack size reached: [json_root,root,...]
    at Module.createError (monarchCommon.js:45:1)
    at MonarchTokenizer._myTokenize (monarchLexer.js:587:1)
    at MonarchTokenizer._tokenize (monarchLexer.js:398:1)
    at MonarchTokenizer.tokenizeEncoded (monarchLexer.js:391:1)
    at safeTokenize (textModelTokens.js:322:1)
    at TokenizerWithStateStoreAndTextModel.updateTokensUntilLine (textModelTokens.js:43:1)
    at DefaultBackgroundTokenizer._tokenizeOneInvalidLine (textModelTokens.js:414:1)
    at DefaultBackgroundTokenizer._backgroundTokenizeForAtLeast1ms (textModelTokens.js:394:1)
    at Object.execute [as callback] (textModelTokens.js:368:1)
    at platform.js:126:1
    at errors.js:15:1
@sakurai-youhei sakurai-youhei added bug Fixes for quality problems that affect the customer experience Feature:Console Dev Tools Console Feature labels Jun 23, 2024
@botelastic botelastic bot added the needs-team Issues missing a team label label Jun 23, 2024
@jughosta jughosta added the Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more label Jun 23, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-management (Team:Kibana Management)

@botelastic botelastic bot removed the needs-team Issues missing a team label label Jun 23, 2024
@yuliacech
Copy link
Contributor

While creating the lexer rules (in this file) for Console language definition in Monaco, we missed the triple quotes rules. I think this error is caused by the missing rules for triple quotes.

ElenaStoeva added a commit that referenced this issue Jul 23, 2024
Fixes #186765

## Summary

This PR fixes the uncaught error from the tokenizer when we add the
input below:

<details>
<summary>Test input</summary>

```
GET /
GET _cluster/settings?include_defaults&flat_settings&filter_path=*.*interval*
PUT _cluster/settings
{
  "persistent": {
    "indices.lifecycle.poll_interval": "10s"
  }
}

GET _cat/${TEST}

PUT _data_stream/test-cold
POST test-cold/_rollover

GET _cat/indices?v&h=
GET _cat/indices/.alerts-observability.threshold.alerts-default,.alerts-default.alerts-default,

GET _cat/indices,aliases

GET _cat/shards/test*?v
"""
index                                    shard prirep state      docs store dataset ip         node
.ds-test-cold-2024.05.20-000002          0     p      STARTED       0  249b    249b 172.19.0.2 839a1677bdab
.ds-test-cold-2024.05.20-000002          0     r      UNASSIGNED                               
restored-.ds-test-cold-2024.05.20-000001 0     p      STARTED       0  289b    289b 172.19.0.2 839a1677bdab
"""

GET restored-.ds-test-cold-2024.05.20-000001/_settings

"""
          "snapshot": {
            "snapshot_name": "2024.05.20-.ds-test-cold-2024.05.20-000001-test-h5yr-_tws6es6biug0uqbw",
            "index_uuid": "8tXgFf_cR2KIMofpj2I7Uw",
            "repository_uuid": "3i3oPavIQZGeYOQzRZajyQ",
            "index_name": ".ds-test-cold-2024.05.20-000001",
            "repository_name": "fs",
            "snapshot_uuid": "3S3CDGZgSh2XQSRO3UTxVA"
          }
"""

DELETE _snapshot/fs/2024.05.20-.ds-test-cold-2024.05.20-000001-test-h5yr-_tws6es6biug0uqbw

POST _ilm/stop

POST restored-.ds-test-cold-2024.05.20-000001/_clone/.ds-test-cold-2024.05.20-000001
{
  "settings": {
    "index.store.type": null,
    "index.recovery.type": null
  }
}

# Check the cloned index & shards
GET _cat/indices/.ds-test-cold-2024.05.20-000001?v
GET _cat/shards/.ds-test-cold-2024.05.20-000001?v

PUT _snapshot/fs/2024.05.20-.ds-test-cold-2024.05.20-000001
{
  "indices": ".ds-test-cold-2024.05.20-000001",
  "ignore_unavailable": false,
  "include_global_state": false
}

# Check the taken snapshot

GET _snapshot/fs/2024.05.20-.ds-test-cold-2024.05.20-000001
"""
      "snapshot": "2024.05.20-.ds-test-cold-2024.05.20-000001",
      "uuid": "GC7xoG1yQN6W5LIUMqCDYA",
"""




PUT _snapshot/fs/temp-snapshot-for-recovery
{
  "indices": "restored-.ds-test-cold-2024.05.20-000001",
  "ignore_unavailable": false,
  "include_global_state": false
}
GET _snapshot/fs/temp-snapshot-for-recovery
"""
      "snapshot": "temp-snapshot-for-recovery",
      "uuid": "NgFDtQMESv2o4BZd0dsP8g",
"""

GET .ds-test-cold-2024.05.20-000002
"""
{
  ".ds-test-cold-2024.05.20-000002": {
    "aliases": {},
    "mappings": {
      "_data_stream_timestamp": {
        "enabled": true
      },
      "properties": {
        "@timestamp": {
          "type": "date"
        }
      }
    },
    "settings": {
      "index": {
        "lifecycle": {
          "name": "test"
        },
        "routing": {
          "allocation": {
            "include": {
              "_tier_preference": "data_hot"
            }
          }
        },
        "hidden": "true",
        "number_of_shards": "1",
        "provided_name": ".ds-test-cold-2024.05.20-000002",
        "creation_date": "1716175738940",
        "priority": "100",
        "number_of_replicas": "1",
        "uuid": "nvldBwt2QxeQzpkrbK69qQ",
        "version": {
          "created": "8503000"
        }
      }
    },
    "data_stream": "test-cold"
  }
}
"""


```
</details>

**How to test:** Add the input above in Console editor and verify that
there is no uncaught error in the browser error.

This change also resolves some highlighting inconsistencies, where some
text was incorrectly highlighted as a `method` and `url` tokens:

Before:

<img width="919" alt="Screenshot 2024-07-19 at 17 15 05"
src="https://github.com/user-attachments/assets/3865f5ee-3f8e-4f85-a44d-a7ee73338621">


<img width="919" alt="Screenshot 2024-07-19 at 17 24 33"
src="https://github.com/user-attachments/assets/07326394-8425-40fd-863e-8314e15763fb">

<br><br>

Now:

<img width="919" alt="Screenshot 2024-07-19 at 17 12 07"
src="https://github.com/user-attachments/assets/e2afde99-bc49-4dc5-ad4f-4727ef604534">


<img width="919" alt="Screenshot 2024-07-19 at 17 25 39"
src="https://github.com/user-attachments/assets/e8778eb2-93be-461f-80f0-abdc810874b4">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Console Dev Tools Console Feature Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants