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

Presentation: Set serialized responses as Napi::Buffer to avoid copying native string to Napi::String #283

Merged
merged 2 commits into from
May 18, 2023

Conversation

grigasp
Copy link
Member

@grigasp grigasp commented May 17, 2023

Related to #275.

The change doesn't fix the problem altogether, but makes the request:

  • fail instead of crashing the whole backend,
  • require less peak memory,
  • slightly quicker as we don't need to copy the string which may sometimes be massive (100+ MB).

The consolidated descriptor request will still fail for the iModel mentioned in the Sentry report due to massive amount of duplicated aspects in the iModel. The request is to load all properties of all aspects and the response is 700+ MB serialized JSON string. Node supports up to 512 MB strings and fails.

itwinjs-core PR: iTwin/itwinjs-core#5534
itwinjs-core: https://github.com/iTwin/itwinjs-core/tree/presentation/accept-buffer-responses-from-addon

@grigasp grigasp linked an issue May 17, 2023 that may be closed by this pull request
@grigasp
Copy link
Member Author

grigasp commented May 17, 2023

/azp run imodel-native

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@grigasp grigasp merged commit 58bd84d into main May 18, 2023
@grigasp grigasp deleted the presentation/avoid-native-string-copy-to-napi-string branch May 18, 2023 07:58
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

Successfully merging this pull request may close these issues.

Presentation: Crash when serializing response
3 participants