New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 773849 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Cannot change the timezone in existing render process through TZ ; TZ change is not monitored by timezone monitor

Project Member Reported by dats@chromium.org, Oct 11 2017

Issue description

When embedding chromium sometimes it's necessary to enforce particular timezone before navigating to some URL (e.g. rendering web page using headless library). This used to work before ICU because localtime* calls from all processes were proxied to the main browser process, so setting TZ environment variable and calling tzset() was working as expected. With V8 switching to ICU this is no longer working.
 

Comment 1 by js...@chromium.org, Oct 12 2017

For now, switching to ICU was reverted.  Nonetheless, we need to make a switch eventually to fix v8:6031, v8:2137, v8:6076 (and other bugs). 

As for your case:  can you do something like this ?

https://cs.chromium.org/chromium/src/content/zygote/zygote_main_linux.cc?rcl=f21e201655b13db8d51873070f24c3c65bd378f2&l=400

 That is, before sandbox kicks in in your render process, you can call icu::TimeZone::createDefault(). createDefault() can read TZ and honor its value (because sandbox does not yet start). 

Comment 2 by js...@chromium.org, Oct 12 2017

>  v8:6031, v8:2137, v8:6076
 bug v8:6031 ,  bug v8:2137 , bug v8:6076

Comment 3 by dats@chromium.org, Oct 12 2017

I don't think that would be enough. Zygote has already started, so changing timezone in the browser process explicitly will not affect the zygote - it will still run with the host's timezone. To make it work the linked line should somehow "ask" TZ from the main process instead of detecting it itself.

Comment 4 by dats@chromium.org, Oct 12 2017

For clarity - we are talking about changing TZ in runtime without changing TZ of the hosting system.

Comment 5 by js...@chromium.org, Oct 13 2017

Cc: mark@chromium.org
> For clarity - we are talking about changing TZ in runtime without changing TZ of the hosting system.

That was a missing piece to me. Thanks for the clarification. 

> Zygote has already started,so changing timezone in the browser process explicitly will not affect the zygote 

Yes, true. BTW, the code referred to in comment 1 is run in 'the' zygote process (as its filename implies), but once it's run at the start of the zygote process, a subsequent change in timezone does not affect the zygote process. 

Anyway, this bug is essentially the same as  bug 612010  except that timezone monitor does not monitor TZ change. So, fixing  bug 612010  and triggering timezone change event when you change TZ should work, shouldn't it? 

Comment 6 by dats@chromium.org, Oct 13 2017

Correct, fixing the bug about propagating timezone changes to zygote + honouring TZ changes in the monitor will do the trick.

That said I'm not sure I can think of an efficient way of monitoring TZ variable without polling...
Status: Assigned (was: Untriaged)
Cc: ofrobots@chromium.org
+Ali, this may affect Node.js.

Comment 9 by dats@chromium.org, Mar 7 2018

Owner: ----
This seems to have come back after https://chromium-review.googlesource.com/c/v8/v8/+/857333.
Summary: Cannot change the timezone in existing render process through TZ ; TZ change is not monitored by timezone monitor (was: Forcing timezone through TZ not working with ICU)
 bug 612010  was fixed by crrev.com/ecc9a74e8a6642d . Timezone monitor still does not monitor TZ change.  However, when a new render process is forked, the ICU timezone will be updated if TZ has changed since. 

So, this issue is fixed for new render process, while running render processes wouldn't respond to a change in TZ. 


Sign in to add a comment