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

[BUG] Event parsing error: String length (...) exceeds the maximum length (20000000) #1316

Closed
tgravescs opened this issue Aug 26, 2024 · 3 comments · Fixed by #1326
Closed
Assignees
Labels
bug Something isn't working user_tools Scope the wrapper module running CSP, QualX, and reports (python)

Comments

@tgravescs
Copy link
Collaborator

tgravescs commented Aug 26, 2024

Describe the bug

Looks like Spark 3.5.0 changed the jackson version and now there is a max json string length configuration. One of our customers hit this issue running the qualification tool, see:

https://issues.apache.org/jira/browse/SPARK-47150

Note that if the event isn't critical it will just ignore it and go on, I assume if it is critical that app may not be qualified properly.
A temporary solution is to go back to 3.4.X. But we may want to look at setting that spark config to up the maximum allowed.

full stack trace:

24/08/24 07:33:26 ERROR EventUtils: Unknown exception while parsing an event

        | com.fasterxml.jackson.core.exc.StreamConstraintsException: String length (20030999) exceeds the maximum length (20000000)

        |       at com.fasterxml.jackson.core.StreamReadConstraints.validateStringLength(StreamReadConstraints.java:324)

        |       at com.fasterxml.jackson.core.util.ReadConstrainedTextBuffer.validateStringLength(ReadConstrainedTextBuffer.java:27)

        |       at com.fasterxml.jackson.core.util.TextBuffer.finishCurrentSegment(TextBuffer.java:939)

        |       at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._finishString2(ReaderBasedJsonParser.java:2240)

        |       at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._finishString(ReaderBasedJsonParser.java:2206)

        |       at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.getText(ReaderBasedJsonParser.java:323)

        |       at com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer._deserializeContainerNoRecursion(JsonNodeDeserializer.java:572)

        |       at com.fasterxml.jackson.databind.deser.std.JsonNodeDeserializer.deserialize(JsonNodeDeserializer.java:100)

        |       at com.fasterxml.jackson.databind.deser.std.JsonNodeDeserializer.deserialize(JsonNodeDeserializer.java:25)

        |       at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323)

        |       at com.fasterxml.jackson.databind.ObjectMapper._readTreeAndClose(ObjectMapper.java:4867)

        |       at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:3219)

        |       at org.apache.spark.util.JsonProtocol$.sparkEventFromJson(JsonProtocol.scala:850)

        |       at org.apache.spark.util.JsonProtocol.sparkEventFromJson(JsonProtocol.scala)

        |       at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
@tgravescs tgravescs added ? - Needs Triage bug Something isn't working labels Aug 26, 2024
@amahussein amahussein added user_tools Scope the wrapper module running CSP, QualX, and reports (python) and removed ? - Needs Triage labels Aug 29, 2024
@amahussein
Copy link
Collaborator

amahussein commented Aug 29, 2024

I cannot find a way to set JSONOptions(maxStringLen) in spark configurations. This is a class parameter that needs to be set each time an new instance is created.
The only option we have is to use older spark release by default to avoid this corner case for other customers.
It will be nice if we can make that configurable because currently it is hardcoded.

@tgravescs
Copy link
Collaborator Author

so I'm not atually sure if that spark config is being used at all, we are using the JsonProtocol to read the json events. that has its own json mapper:

  protected val mapper: ObjectMapper = new ObjectMapper().registerModule(DefaultScalaModule)
    .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)

Which pehaps has a default the same max string len? Anyway, I do wonder if we could override that by making our own class

@amahussein
Copy link
Collaborator

After discussing this issue offline with @tgravescs , we decided to do the following:

  • Set the default spark version to older release for OnPrem. This requires:
    • test that no runtime error can be caused by using an older version of runtime with a version compiled with spark 3.5
  • Allow the spark version to be overridden. i.e., add a new tools env_var that can override the default spark version
  • Update the documentation to highlight that new config

@amahussein amahussein self-assigned this Sep 3, 2024
amahussein added a commit to amahussein/spark-rapids-tools that referenced this issue Sep 3, 2024
Signed-off-by: Ahmed Hussein <[email protected]>

Fixes NVIDIA#1316

Allow user-tools to pick the SPARK dependencies based on a runtime
env_var. The value format follows the same format of `buildver` in the
scala pom file.
Currently 333 and 350 (default) are supported.
If user specifies an invalid value, there will be a warning message,
then the process fails running the java cmd.

**Changes**

- Add dependency key to the platform config-file
- A platform can define its own default dependency versions using
  `activeBuildVer` key
- Add a default `RUNTIME_BUILDVER` in the `__init__.py` to allow
  upgrades of spark release during official releases
- Read an env_var `RAPIDS_USER_TOOLS_RUNTIME_BUILDVER` to pick the
  correct dependency.
- Currently, only `333` and `350` are supported. Default is `350`
amahussein added a commit to amahussein/spark-rapids-tools that referenced this issue Sep 24, 2024
Signed-off-by: Ahmed Hussein (amahussein) <[email protected]>

Followup on NVIDIA#1326 to set the default spark version to 3.4.2 for onPrem
to avoid the bug described in NVIDIA#1316 without need to do something on
customer side.
amahussein added a commit that referenced this issue Sep 24, 2024
Signed-off-by: Ahmed Hussein (amahussein) <[email protected]>

Followup on #1326 to set the default spark version to 3.4.2 for onPrem
to avoid the bug described in #1316 without need to do something on
customer side.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working user_tools Scope the wrapper module running CSP, QualX, and reports (python)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants