Skip to content
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

Inconsistent outputs due to timezone #301

Closed
benjaminRomano opened this issue Mar 12, 2020 · 5 comments
Closed

Inconsistent outputs due to timezone #301

benjaminRomano opened this issue Mar 12, 2020 · 5 comments

Comments

@benjaminRomano
Copy link
Contributor

Background
I'm seeing cache misses due to the kotlin jars have different file timestamps. It appears, the kotlin rules depend on the system default timezone which may not be consistent across machines.

Suggested Fix
It seems that setting the timezone to "UTC" should resolve this issue, but I still saw inconsistencies in timestamps between CI and my local machine. I haven't had a chance to debug further, but one thing I was doing differently was depending on kotlin rules using git_repository instead of building the release artifact.

Workaround
I'm able to workaround this issue by setting my machines timezone to match our CI builder's timezone UTC for the time being.

@davidsantiago
Copy link

It looks like there's an old PR (#167) that touches the same line you've identified, but it looks like they're solving the problem differently. Does this PR look like it would fix the issue for you?

@benjaminRomano
Copy link
Contributor Author

Interesting. I found the original commit that introduced this change here. It seems including the timezone is intentional.

@davidsantiago
Copy link

Do I understand from your comment that you updated the code in rules_kotlin to specify UTC as the time zone and it still had inconsistencies? Or did you mean updating the timezone of your local machine?

@benjaminRomano
Copy link
Contributor Author

benjaminRomano commented Mar 17, 2020

Sorry for slow response. I updated the code to use a standard timezone, UTC; however, this was not the correct solution as it causes the timezone information to always be encoded within the zip.

I tracked down the root cause when investigating a similar issue within Bazel's android rules. The problem is JDK 8 appears to have a bug when using unix epoch. It will encode the system's timezone into the zip archive making it non-reproducible. There's a good explanation of the issue within Gradle's archiving source code: https://github.com/gradle/gradle/blob/master/subprojects/core/src/main/java/org/gradle/api/internal/file/archive/ZipCopyAction.java#L42-L56

@cgruber
Copy link
Collaborator

cgruber commented Jun 3, 2020

Fixed in #304

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

3 participants