Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@gaaclarke
Copy link
Member

@gaaclarke gaaclarke commented May 9, 2023

fixes flutter/flutter#125571

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@gaaclarke gaaclarke marked this pull request as ready for review May 9, 2023 16:26
@gaaclarke gaaclarke requested a review from jason-simmons May 9, 2023 16:26
});
return fence_waiter_->AddFence(std::move(fence),
[tracked_objects = std::move(tracked_objects_),
strong_device = std::move(strong_device)] {
Copy link
Member

Choose a reason for hiding this comment

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

Why is this capturing a strong reference to the ContextVK in the lambda?

TrackedObjectsVK holds a weak reference to the CommandPoolVK. That should allow cleanup of the tracked objects if the CommandPoolVK and the ContextVK/vk::Device are still alive (and do nothing if they are already gone)

Copy link
Member Author

Choose a reason for hiding this comment

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

It's because that buffer.release() call that you just added wasn't in the TrackedObjects destructor. This may no longer be necessary after your change. Let me test it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope, is still necessary. It crashes without it because VALIDATION_LOG has an abort in it. I'll remove it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Our options are to keep a strong hold on the device in the fence, or to release the buffer without crashing. I believe you prefer removing the strong link and calling release(). I think I do too so I did that, although I'm unhappy about the C++ vulkan wrapper and how it looks like a leak.


void CommandPoolVK::ClearAllPools(const ContextVK* context) {
if (tls_command_pool.get()) {
tls_command_pool.get()->erase(context->GetHash());
Copy link
Member

Choose a reason for hiding this comment

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

Move this to the end of the function so it runs after the block that calls Reset on every CommandPoolVK associated with this context.

In theory this should be unnecessary because nobody else should be holding on to a strong reference to this thread's CommandPoolVK, and the erase should destruct it and do all the necessary cleanup. But for safety I think if would be prudent to ensure that the current thread's CommandPoolVK for this context is explicitly reset at the same time as the ones for other threads.

Copy link
Member

Choose a reason for hiding this comment

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

Actually I just realized this is unnecessary. If this thread's CommandPoolVK is still alive after the tls_command_pool.erase, then the corresponding weak_ptr in g_all_pools will still be promotable to a shared_ptr and will get the Reset call.

So the current implementation in the PR will work as intended.

@gaaclarke gaaclarke requested a review from jason-simmons May 9, 2023 18:24
@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label May 9, 2023
@auto-submit auto-submit bot merged commit 4979e8b into flutter:main May 9, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 9, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 10, 2023
zanderso pushed a commit to flutter/flutter that referenced this pull request May 10, 2023
…ions) (#126445)

Manual roll requested by [email protected]

flutter/engine@78f41a8...10ac36c

2023-05-09 [email protected] Implement text rendering in Skwasm
(flutter/engine#41832)
2023-05-09 [email protected] Roll Fuchsia Linux SDK from
leCRDVJ8szOS2LsPV... to lf8VcONMWlne4oa3H... (flutter/engine#41876)
2023-05-09 [email protected] [Impeller]
started cleaning up pools when devices are deleted
(flutter/engine#41857)
2023-05-09 [email protected] Roll Fuchsia Mac SDK from
c4JvQUEOBHgtRdNPc... to JiOACcaGrDphuHIql... (flutter/engine#41874)
2023-05-09 [email protected] Move linux_license to engine v2.
(flutter/engine#41863)
2023-05-09 [email protected] Replace Windows Unopt with the engine
v2 version. (flutter/engine#41861)

Also rolling transitive DEPS:
  fuchsia/sdk/core/linux-amd64 from leCRDVJ8szOS to lf8VcONMWlne
  fuchsia/sdk/core/mac-amd64 from c4JvQUEOBHgt to JiOACcaGrDph

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected],[email protected],[email protected] on the
revert to ensure that a human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
CaseyHillers pushed a commit to CaseyHillers/flutter that referenced this pull request May 24, 2023
…ions) (flutter#126445)

Manual roll requested by [email protected]

flutter/engine@78f41a8...10ac36c

2023-05-09 [email protected] Implement text rendering in Skwasm
(flutter/engine#41832)
2023-05-09 [email protected] Roll Fuchsia Linux SDK from
leCRDVJ8szOS2LsPV... to lf8VcONMWlne4oa3H... (flutter/engine#41876)
2023-05-09 [email protected] [Impeller]
started cleaning up pools when devices are deleted
(flutter/engine#41857)
2023-05-09 [email protected] Roll Fuchsia Mac SDK from
c4JvQUEOBHgtRdNPc... to JiOACcaGrDphuHIql... (flutter/engine#41874)
2023-05-09 [email protected] Move linux_license to engine v2.
(flutter/engine#41863)
2023-05-09 [email protected] Replace Windows Unopt with the engine
v2 version. (flutter/engine#41861)

Also rolling transitive DEPS:
  fuchsia/sdk/core/linux-amd64 from leCRDVJ8szOS to lf8VcONMWlne
  fuchsia/sdk/core/mac-amd64 from c4JvQUEOBHgt to JiOACcaGrDph

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected],[email protected],[email protected] on the
revert to ensure that a human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Impeller] Vulkan test runner is leaking CommandPoolVKs

2 participants