Skip to content

Fix finalizer tests #1338

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

Merged
merged 2 commits into from
Jul 5, 2022
Merged

Fix finalizer tests #1338

merged 2 commits into from
Jul 5, 2022

Conversation

dcharkes
Copy link
Contributor

@dcharkes dcharkes commented May 6, 2022

Closes #1337

@dcharkes dcharkes requested a review from alexmarkov May 6, 2022 07:46
Copy link

@alexmarkov alexmarkov left a comment

Choose a reason for hiding this comment

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

Consider also requesting a review from someone more familiar with Finalizer/WeakReference specification.

await attachToFinalizer();
// Previous triggerGc move some objects to old space. Do multiple GCs to
// force all objects to old space.
await triggerGcWithDelay(repeat: 3);

Choose a reason for hiding this comment

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

This comment and additional GCs look very implementation-specific. My understanding is that these tests should only rely on the specification.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Finalizer specification says that objects may be collected. So then we cannot have a single test that checks that an object is collected.

@lrhn please advise.

@dcharkes dcharkes requested review from alexmarkov and lrhn May 6, 2022 15:57
Copy link

@alexmarkov alexmarkov left a comment

Choose a reason for hiding this comment

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

Lgtm, assuming the remaining comments are addressed.

@sgrekhov
Copy link
Contributor

sgrekhov commented Jul 5, 2022

@dcharkes what is the status of this PR? It is approved but there are still some open questions. If you want I can go on work on this PR

@dcharkes
Copy link
Contributor Author

dcharkes commented Jul 5, 2022

I think we can land it as is.

It does not really make sense to only conform to specification, because that means we cannot test any finalizers (finalizers may run, objects may be GCed).

Thanks for pinging the PR @sgrekhov.

@dcharkes dcharkes merged commit da8a31f into master Jul 5, 2022
@dcharkes dcharkes deleted the fix-finalizer-tests branch July 5, 2022 09:13
copybara-service bot pushed a commit to dart-lang/sdk that referenced this pull request Jul 14, 2022
2022-07-13 [email protected] Add initial specparser workflow (dart-lang/co19#1364)
2022-07-07 [email protected] Fixes dart-lang/co19#1355. Expect that `Process.killPid` returns `false` only if process is already dead (dart-lang/co19#1357)
2022-07-06 [email protected] Fixes dart-lang/co19#1328. Fix error expectation places for CFE (dart-lang/co19#1353)
2022-07-05 [email protected] Fixes dart-lang/co19#1309. Update error expectations according to the current behavior (dart-lang/co19#1352)
2022-07-05 [email protected] Fix finalizer tests (dart-lang/co19#1338)
2022-07-04 [email protected] Fixes dart-lang/co19#1343. Use correct 'part' and 'part of' directives (dart-lang/co19#1349)
2022-07-04 [email protected] Fix typos (dart-lang/co19#1341)
2022-07-04 [email protected] Fixes dart-lang/co19#1340. Update expected error locations for CFE (dart-lang/co19#1348)
2022-07-04 [email protected] Fixes dart-lang/co19#1344. Wait for entryPoint is invoked before doing the test (dart-lang/co19#1346)
2022-07-01 [email protected] Fixes dart-lang/co19#1342. Expect STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR for C?.foo (dart-lang/co19#1347)

Change-Id: I1d5b116297f4b94930988914de4c0e03b68b2b8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251463
Reviewed-by: Alexander Thomas <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LanguageFeatures/FinalizationRegistry/ffi/Finalizer/Finalizer_A01_t01
3 participants