-
Notifications
You must be signed in to change notification settings - Fork 5.9k
8348323: Corrupted timezone string in JVM crash log #23246
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
Conversation
👋 Welcome back dhanalla! A progress list of the required criteria for merging this PR into |
@dhanalla This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 22 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@dholmes-ora, @offamitkumar, @kevinjwalls) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
Webrevs
|
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.
Change looks good, but I'm very curious as to why wcstombs
is actually failing i.e. where the bad input is coming from?
Thank you @dholmes-ora, I’m not sure about the locale of the timezone input, but according to the crash report shared by one of our clients, wcstombs seems to be failing to convert wide character to a multibyte string. |
/integrate |
/reviewers 2 |
@dhanalla all hotspot changes require two reviews |
@dholmes-ora |
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.
If wcstombs
fails, it will return -1
of size_t
type. So change looks correct.
I guess you should update copyright header year also. |
Hi, It would be great to have more info/examples in the JBS issue. What timezone are the machines actually set to? |
@dhanalla this pull request can not be integrated into git checkout Corrupted-Timezone-String
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
Thanks @kevinjwalls, One of our client's crash collection systems has captured this report; however, we currently do not have information regarding the locale or timezone of the user at the time the crash occurred. |
Thanks @offamitkumar, Merging with the latest version of this file updated the year in the copyright header. |
OK thanks. It seems like there is more to the mystery that is not yet solved. 8-) I don't disagree that we should check wcstombs' return value. When we look at this kind of thing in future it will be no timezone printed that means we have hit an existing problem fetching a valid timezone. |
Just a thought, can't use this logic to make it more clear ? : diff --git a/src/hotspot/share/runtime/os.cpp b/src/hotspot/share/runtime/os.cpp
index 094d68e1a84..aea9aee5adf 100644
--- a/src/hotspot/share/runtime/os.cpp
+++ b/src/hotspot/share/runtime/os.cpp
@@ -1213,8 +1213,12 @@ void os::print_date_and_time(outputStream *st, char* buf, size_t buflen) {
wchar_t w_buf[80];
size_t n = ::wcsftime(w_buf, 80, L"%Z", &tz);
if (n > 0) {
- ::wcstombs(buf, w_buf, buflen);
- st->print("Time: %s %s", timestring, buf);
+ bool success = (::wcstombs(buf, w_buf, buflen) != (size_t)-1);
+ if (success) {
+ st->print("Time: %s %s", timestring, buf);
+ } else {
+ st->print("Time: %s (Error: Failed to convert timezone to multi-byte string)", timestring);
+ }
} else {
st->print("Time: %s", timestring);
} |
Thanks @offamitkumar, |
/integrate |
why is that ? I think wchar_t w_buf[80];
size_t n = ::wcsftime(w_buf, 80, L"%Z", &tz); which then we try to convert to multi byte string. There are two cases in my solution. With |
Hi, I understand the idea of showing the error message. Concerned that printed in-line it makes the line very long, may obscure the elapsed time in some situations. This hs_err line may be parsed by tools, so adding a free form error message may be harder to parse than no timezone. Not printing a timezone will mean we couldn't decode one. The case I noted in JDK-8340465 was that setting a TZ variable may contain something that wasn't recognised in Windows. That's why I asked if we knew what TZ was in the case here. There might be more to do here in another change, but it wasn't clear if we can ignore TZ, and use the Windows api only, or if that creates other problems. |
Aah, I see. That makes sense. I am fine with current changes as well. |
Thanks. |
/sponsor |
Going to push as commit 2bef5b4.
Your commit was automatically rebased without conflicts. |
@kevinjwalls @dhanalla Pushed as commit 2bef5b4. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
/backport jdk21u-dev |
@dhanalla the backport was successfully created on the branch backport-dhanalla-2bef5b4a-master in my personal fork of openjdk/jdk21u-dev. To create a pull request with this backport targeting openjdk/jdk21u-dev:master, just click the following link: The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:
If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21u-dev:
|
/backport jdk24u |
@dhanalla the backport was successfully created on the branch backport-dhanalla-2bef5b4a-master in my personal fork of openjdk/jdk24u. To create a pull request with this backport targeting openjdk/jdk24u:master, just click the following link: The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:
If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk24u:
|
Add a error check to "wcstombs" otherwise the "buf" prints junk or corrupted string.
Test performed:
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/23246/head:pull/23246
$ git checkout pull/23246
Update a local copy of the PR:
$ git checkout pull/23246
$ git pull https://git.openjdk.org/jdk.git pull/23246/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 23246
View PR using the GUI difftool:
$ git pr show -t 23246
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/23246.diff
Using Webrev
Link to Webrev Comment