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

Add a check for empty kernel files #2387

Merged
merged 2 commits into from
Jul 30, 2019
Merged

Add a check for empty kernel files #2387

merged 2 commits into from
Jul 30, 2019

Conversation

natebosch
Copy link
Member

Towards #2362

We don't know where the zero byte files are being introduced to the
system - if they are coming from the kernel worker try to catch them
earlier by checking for when we copy a file with no content. This won't
solve the issue but if errors surface through this they should be more
clear.

  • Add a requireContent argument to copyOutput. In the future we
    might consider making the default either with or without an output -
    we don't know of any use cases where we want to allow copying a zero
    byte file.
  • Use the new argument from the kernel builder to check earlier whether
    a kernel file is empty.

Towards #2362

We don't know where the zero byte files are being introduced to the
system - if they are coming from the kernel worker try to catch them
earlier by checking for when we copy a file with no content. This won't
solve the issue but if errors surface through this they should be more
clear.

- Add a `requireContent` argument to `copyOutput`. In the future we
  might consider making the default either with or without an output -
  we don't know of any use cases where we want to allow copying a zero
  byte file.
- Use the new argument from the kernel builder to check earlier whether
  a kernel file is empty.
@natebosch natebosch requested a review from jakemac53 July 30, 2019 21:35
@googlebot googlebot added the cla: yes Google is happy with the PR contributors label Jul 30, 2019
@@ -1,3 +1,7 @@
## 2.4.1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: leave -dev until we are actually ready to publish (dev dependencies removed) - ideally in the pubspec too

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will keep that in mind for next time - I plan to publish right away so I won't bother waiting for another round of travis this time.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sgtm

@natebosch natebosch merged commit c2aa96a into master Jul 30, 2019
@natebosch natebosch deleted the require-kernel-content branch July 30, 2019 23:07
dart-bot pushed a commit to dart-lang/sdk that referenced this pull request Oct 31, 2019
Problem:

We have been having a lot of reports of failures when initializing the incremental compiler
(see #38102).

These appear to be the result of empty kernel files but we have added other logic to check
for that when kernel files are written, which has had zero reports of throwing from users
(dart-lang/build#2387).

We also use the same mechanism for temp directory management as we did with analyzer, but only
see this problem with the switch to kernel, and specifically the incremental compiler.

Solution:

Add retry logic and see if that fixes the problem. Any time there is a retry log a warning
so that we don't just silently do retries all the time.

This is a general defensive mechanism to cover a broad spectrum of potential failures with the
incremental compiler in the wild. I don't intend to remove it as it isn't harmful, and the
warning logs should be enough to encourage issues to be filed if it is happening often.

I have no direct reason to believe this will actually solve the particular linked problem other
than that we only see this issue when the incremental compiler is enabled.

Bug: #39122, #38102
Change-Id: Iaabb4497d6da69684692c1d7b9c030c59ebc6072
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123001
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Google is happy with the PR contributors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants