Skip to content

Conversation

@jackhorton
Copy link
Contributor

This modifies a recent change that attempted to initialize ICU before calling any Intl functions in an effort to catch OOM scenarios early. I originally added the code to IntlEngineInterfaceExtensionObject::Initialize, which seemed reasonable, but I forgot that Initialize is always called as part of JavascriptLibrary initialization. As a result, this code was being run on startup at all times. This broke Node-ChakraCore because they have special handling for ICU data, and we were calling u_init before Node's data initialization logic ran. The fix is to initialize ICU in the deferred type handler initialization for the Intl native interfaces, which should only run when script code actually uses Intl (which will always be after Node sets up ICU themselves).

…ized

This modifies a recent change that attempted to initialize ICU before calling any Intl functions in an effort to catch OOM scenarios early. I originally added the code to IntlEngineInterfaceExtensionObject::Initialize, which seemed reasonable, but I forgot that Initialize is always called as part of JavascriptLibrary initialization. As a result, this code was being run on startup at all times. This broke Node-ChakraCore because they have special handling for ICU data, and we were calling u_init before Node's data initialization logic ran. The fix is to initialize ICU in the deferred type handler initialization for the Intl native interfaces, which should only run when script code actually uses Intl (which will always be after Node sets up ICU themselves).
@jackhorton
Copy link
Contributor Author

@dotnet-bot test OSX _no_jit_shared_osx_osx_test please
test OSX static_osx_osx_debug please
test OSX static_osx_osx_release please

@chakrabot chakrabot merged commit 94b2fdd into chakra-core:master Apr 17, 2018
chakrabot pushed a commit that referenced this pull request Apr 17, 2018
…ive interfaces are initialized

Merge pull request #5001 from jackhorton:icu/defer-initialize

This modifies a recent change that attempted to initialize ICU before calling any Intl functions in an effort to catch OOM scenarios early. I originally added the code to IntlEngineInterfaceExtensionObject::Initialize, which seemed reasonable, but I forgot that Initialize is always called as part of JavascriptLibrary initialization. As a result, this code was being run on startup at all times. This broke Node-ChakraCore because they have special handling for ICU data, and we were calling u_init before Node's data initialization logic ran. The fix is to initialize ICU in the deferred type handler initialization for the Intl native interfaces, which should only run when script code actually uses Intl (which will always be after Node sets up ICU themselves).
@jefgen
Copy link
Collaborator

jefgen commented Apr 17, 2018

Testing out mentioning @Microsoft/target-dev in a code review.

Copy link
Collaborator

@jefgen jefgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

chakrabot pushed a commit that referenced this pull request Apr 22, 2018
…Kit ICU

Merge pull request #5011 from jackhorton:icu/init-windows-kit

Third attempt at this after #4984 and #5001, but I have actually confirmed that this makes Node-ChakraCore's chakracore-master branch build, launch, and run Intl code successfully once more. This definitely isn't the best solution, however if we refer to https://github.com/nodejs/node-chakracore/blob/d94b22785fb6ab7dde77cb13b7e95e958e581375/src/node_i18n.cc#L568-L581, we can see that Node somewhat explicitly also does not call u_init if they call udata_setCommonData.
@jackhorton jackhorton deleted the icu/defer-initialize branch April 30, 2018 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants