Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Fix failures caused by ICU regression #24190

Merged
merged 1 commit into from Apr 23, 2019

Conversation

tarekgh
Copy link
Member

@tarekgh tarekgh commented Apr 23, 2019

Fixes https://github.com/dotnet/corefx/issues/37098

.NET Core depends on ICU when running on Linux/OSX. Recently some people raised some failure on the framework stack. After investigation we found a regression in ICU which is the root cause of this failure. The regression is, when calling ICU to get some date patterns/properties, in some cases ICU return error code U_MISSING_RESOURCE_ERROR. Although the framework code written to fallback to some invariant values at that time, but we had some wrong line of code which assumed we never fail and trying to access the returned value without checking. That cause the framework to throw NullReferenceException.

The fix here is to make the framework resilient against such cases and continue to run nicely. I have contact ICU support members and I learned there is similar issue tracked in ICU repo https://unicode-org.atlassian.net/browse/ICU-20558

Fixes https://github.com/dotnet/corefx/issues/37098

.NET Core depends on ICU when running on Linux/OSX. Recently some people raised some failure on the framework stack. After investigation we found a regression in ICU which is the root cause of this failure. The regression is, when calling ICU to get some date patterns/properties, in some cases ICU return error code U_MISSING_RESOURCE_ERROR. Although the framework code written to fallback to some invariant values at that time, but we had some wrong line of code which assumed we never fail and trying to access the returned value without checking. That cause the framework to throw NullReferenceException.

The fix here is to make the framework resilient against such cases and continue to run nicely. I have contact ICU support members and I learned there is similar issue tracked in ICU repo https://unicode-org.atlassian.net/browse/ICU-20558
@tarekgh
Copy link
Member Author

tarekgh commented Apr 23, 2019

CC @jkotas @krwq @stephentoub

if (this.sMonthDay != null)
{
this.sMonthDay = NormalizeDatePattern(this.sMonthDay);
}
Copy link
Member

Choose a reason for hiding this comment

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

Is this the code path that could be affected by missing resources?

Copy link
Member Author

Choose a reason for hiding this comment

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

resources here doesn't mean the localized resources, it means the ICU resources (e.g. day or month names...etc.). So, this is the code path we read/get this ICU resources.

Copy link
Member

Choose a reason for hiding this comment

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

Understood. But this line is just accounting for sMonthDay not having been read. I'm asking if there are others besides that, where we assume some field was filled in but it wasn't because ICU was missing the relevant resource.

Copy link
Member Author

Choose a reason for hiding this comment

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

The method LoadCalendarDataFromSystem is the place we fill such properties. sMonthDay is the only property we read and access it before we check it. Note the rest of the code in this method doesn't try to access any of such properties we read. if you look at the other file CultureData.cs where I removed the assert, this is the palace we check which property we couldn't read and then fill it with the invariant values.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, thanks.

@tarekgh
Copy link
Member Author

tarekgh commented Apr 23, 2019

I forgot to mention the side effect of this problem is very bad as this cause the dotnet tools (e.g. msbuild, telemetry...etc.) to fail in addition to almost every built app at runtime. The good news is, there is a work around by setting LANG value to something like en_US.UTF-8.

@stephentoub
Copy link
Member

I forgot to mention the side effect of this problem is very bad

Should we consider servicing 2.x for this?

@tarekgh
Copy link
Member Author

tarekgh commented Apr 23, 2019

Should we consider servicing 2.x for this?

I am not sure if this will meet the bar as there is easy workaround when the problem occur. I'll try to check anyway.

@tarekgh
Copy link
Member Author

tarekgh commented Apr 23, 2019

unicode-org/icu#632 the ICU PR for that issue.

@tarekgh
Copy link
Member Author

tarekgh commented Apr 23, 2019

Any other feedback here? thanks @stephentoub for reviewing here.

@krwq
Copy link
Member

krwq commented Apr 23, 2019

@tarekgh LGTM but wanted to double check

if (this.sMonthDay == null) this.sMonthDay = Invariant.sMonthDay; // Month/Day format
doesn't have to be normalized?

@tarekgh
Copy link
Member Author

tarekgh commented Apr 23, 2019

@krwq No, the invariant name is already normalized.

@tarekgh tarekgh merged commit cbc358d into dotnet:master Apr 23, 2019
Dotnet-GitSync-Bot pushed a commit to Dotnet-GitSync-Bot/corefx that referenced this pull request Apr 23, 2019
Fixes https://github.com/dotnet/corefx/issues/37098

.NET Core depends on ICU when running on Linux/OSX. Recently some people raised some failure on the framework stack. After investigation we found a regression in ICU which is the root cause of this failure. The regression is, when calling ICU to get some date patterns/properties, in some cases ICU return error code U_MISSING_RESOURCE_ERROR. Although the framework code written to fallback to some invariant values at that time, but we had some wrong line of code which assumed we never fail and trying to access the returned value without checking. That cause the framework to throw NullReferenceException.

The fix here is to make the framework resilient against such cases and continue to run nicely. I have contact ICU support members and I learned there is similar issue tracked in ICU repo https://unicode-org.atlassian.net/browse/ICU-20558

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Dotnet-GitSync-Bot pushed a commit to Dotnet-GitSync-Bot/corert that referenced this pull request Apr 23, 2019
Fixes https://github.com/dotnet/corefx/issues/37098

.NET Core depends on ICU when running on Linux/OSX. Recently some people raised some failure on the framework stack. After investigation we found a regression in ICU which is the root cause of this failure. The regression is, when calling ICU to get some date patterns/properties, in some cases ICU return error code U_MISSING_RESOURCE_ERROR. Although the framework code written to fallback to some invariant values at that time, but we had some wrong line of code which assumed we never fail and trying to access the returned value without checking. That cause the framework to throw NullReferenceException.

The fix here is to make the framework resilient against such cases and continue to run nicely. I have contact ICU support members and I learned there is similar issue tracked in ICU repo https://unicode-org.atlassian.net/browse/ICU-20558

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
tarekgh added a commit to dotnet/corefx that referenced this pull request Apr 23, 2019
Fixes https://github.com/dotnet/corefx/issues/37098

.NET Core depends on ICU when running on Linux/OSX. Recently some people raised some failure on the framework stack. After investigation we found a regression in ICU which is the root cause of this failure. The regression is, when calling ICU to get some date patterns/properties, in some cases ICU return error code U_MISSING_RESOURCE_ERROR. Although the framework code written to fallback to some invariant values at that time, but we had some wrong line of code which assumed we never fail and trying to access the returned value without checking. That cause the framework to throw NullReferenceException.

The fix here is to make the framework resilient against such cases and continue to run nicely. I have contact ICU support members and I learned there is similar issue tracked in ICU repo https://unicode-org.atlassian.net/browse/ICU-20558

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
tarekgh added a commit to dotnet/corert that referenced this pull request Apr 23, 2019
Fixes https://github.com/dotnet/corefx/issues/37098

.NET Core depends on ICU when running on Linux/OSX. Recently some people raised some failure on the framework stack. After investigation we found a regression in ICU which is the root cause of this failure. The regression is, when calling ICU to get some date patterns/properties, in some cases ICU return error code U_MISSING_RESOURCE_ERROR. Although the framework code written to fallback to some invariant values at that time, but we had some wrong line of code which assumed we never fail and trying to access the returned value without checking. That cause the framework to throw NullReferenceException.

The fix here is to make the framework resilient against such cases and continue to run nicely. I have contact ICU support members and I learned there is similar issue tracked in ICU repo https://unicode-org.atlassian.net/browse/ICU-20558

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
Fixes https://github.com/dotnet/corefx/issues/37098

.NET Core depends on ICU when running on Linux/OSX. Recently some people raised some failure on the framework stack. After investigation we found a regression in ICU which is the root cause of this failure. The regression is, when calling ICU to get some date patterns/properties, in some cases ICU return error code U_MISSING_RESOURCE_ERROR. Although the framework code written to fallback to some invariant values at that time, but we had some wrong line of code which assumed we never fail and trying to access the returned value without checking. That cause the framework to throw NullReferenceException.

The fix here is to make the framework resilient against such cases and continue to run nicely. I have contact ICU support members and I learned there is similar issue tracked in ICU repo https://unicode-org.atlassian.net/browse/ICU-20558

Commit migrated from dotnet/coreclr@cbc358d
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants