Fix failures caused by ICU regression #24190
Conversation
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
if (this.sMonthDay != null) | ||
{ | ||
this.sMonthDay = NormalizeDatePattern(this.sMonthDay); | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, thanks.
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. |
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. |
unicode-org/icu#632 the ICU PR for that issue. |
Any other feedback here? thanks @stephentoub for reviewing here. |
@tarekgh LGTM but wanted to double check
|
@krwq No, the invariant name is already normalized. |
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>
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>
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>
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>
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
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