-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
V8 no longer resets the timezone cache upon invoking v8::Date::DateTimeConfigurationChangeNotification #19974
Comments
Can you be more precise? Does it work when you pass |
I haven't been able to make the testcase work at all, but in cluster workers and VM's the timezone does change. I think this is caused by the different isolate context that is used there, since it probably just didn't have a populated cache yet. The issue seems OS dependent, but not architecture dependent, as the test runs successfully on OSX, but fails on Linux (tested on arm, x64 and x86) |
I've pushed a task to our testfarm and Node.js 7.0.0 on Linux seems to be the first impacted version, which would place the most likely cause at the V8 5.4 upgrade |
@evanlucas Can you comment? FWIW, the date cache reset logic in V8 doesn't really seem to have changed in the last two years or so. |
yea this is strange. On debian jessie for me, it seems like the TZ environment variable is only read on boot or first access (not sure which one) and never read again, even after calling the following:
It does seem to work on macOS though. |
Right, I understand now that the idea is to let you do this: process.env.TZ = 'Europe/Amsterdam'
require('reset-date-cache').reset()
process.env.TZ = 'Europe/London' That doesn't work due to glibc's timezone cache but #20026 addresses that. I'm not 100% convinced it's a good idea but since people keep bumping into TZ's 'immutability', and since it obsoletes |
I’m actually using it in combination with https://github.com/athombv/node-systemd-timedated-client/ to reset the cache when the system timezone changes, which doesnt work either. My TZ env var used to be unset, but i’ve tried both with and without setting it to the changed timezone before resetting the cache. |
The missing piece is the @evanlucas FYI, might want to add that to |
Don’t want to be nitpicking here, but if this is the case, shouldnt it be something the V8 notification should invoke instead of the caller? 🙈 |
You could open a V8 issue but I expect the answer is no. |
Thanks for the fix @bnoordhuis! Just updated |
Reopen due to reverting the original fix. |
Since the presence of the libc and V8 timezone caches seem to be a perennial source of confusion to users ("why doesn't it work?!"), let's try to support that pattern by intercepting assignments to the TZ environment variable and reset the caches as a side effect. Fixes: nodejs#19974 PR-URL: nodejs#20026 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Steven R Loomis <srloomis@us.ibm.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Apparently one of the V8 updates after Node.js
4.8.46.12.2 caused thev8::Date::DateTimeConfigurationChangeNotification
that is triggered by the reset-date-cache module of @evanlucas to not actually invalidate the timezone everywhere. I'm not completely sure if this is i18n related or if it fails to reach thev8::base::TimezoneCache::Clear
stage. Issue has been first reported in the issue tracker of the module, but the cause seems to be in V8 itself instead after more debugging. I'msuspectingthe upgrade to V85.0 or 6.05.4 to be the cause, as there are multiple chromium issues describing similar behaviour after these V8 Engine versions got landed, and a few of them required changes on the chromium side.This issue can be easily reproduced by running the test code of the reset-date-cache module, might be a good candidate for CitGM as well?
The text was updated successfully, but these errors were encountered: