Skip to content

Custom script processor (Painless) gives stackOverFlow Error and causes node crash #101881

@akhilma-kore

Description

@akhilma-kore

Elasticsearch Version

7.17.7

Installed Plugins

No response

Java Version

17.0.8.1

OS Version

Linux ki0566 5.15.0-84-generic #93~20.04.1-Ubuntu SMP

Problem Description

Whenever I try to execute the below custom script the elasticsearch node is always getting crashed with the StackOverflowError
Script:
{"script": {"tag": "Custom Script##1", "ignore_failure": true, "lang": "painless", "source": " ctx.a=ctx;"}}
'''
[2023-11-07T11:45:30,094][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [my_es_node] fatal error in thread [elasticsearch[my_es_node][management][T#4]], exiting
java.lang.StackOverflowError: null
at org.elasticsearch.ingest.IngestDocument.deepCopy(IngestDocument.java:784) ~[elasticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.ingest.IngestDocument.deepCopy(IngestDocument.java:777) ~[elasticsearch-7.17.7.jar:7.17.7]
'''
This is caused due to the circular dependency between the variables. Is there a way we can catch this error and throw it as an exception and avoid ES node crashes?

Steps to Reproduce

** Any simulate/index API with the above mentioned script will reproduce the error

Logs (if relevant)

[2023-11-07T11:45:30,094][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [my_es_node] fatal error in thread [elasticsearch[my_es_node][management][T#4]], exiting
java.lang.StackOverflowError: null
at org.elasticsearch.ingest.IngestDocument.deepCopy(IngestDocument.java:784) ~[elasticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.ingest.IngestDocument.deepCopy(IngestDocument.java:777) ~[elasticsearch-7.17.7.jar:7.17.7]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions