Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Conversation

@schveiguy
Copy link
Member

The original behavior was to assert(false), but this is inconsistent with the standard GC, which ignores removal of ranges it didn't already know about.

The code in question, Array!string, whenever it would realloc, it would removeRange on the previous array, and addRange on the new one. Since it starts out with a null array, removeRange(null) was called.

Arguably, this is not behavior we want (Array could easily be changed to not try and removeRange(null)), but the ProtoGC shouldn't behave differently from the actual GC while it is in charge of things.

Added a simple test to make sure this doesn't happen again.

that were not originally added. Behavior is now consistent with
conservative GC.
@dlang-bot
Copy link
Contributor

dlang-bot commented Jun 18, 2018

Thanks for your pull request, @schveiguy!

Bugzilla references

Auto-close Bugzilla Severity Description
18996 regression Inserting a type containing indirections into an std.container Array causes SIGILL(4). Illegal Instruction.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "stable + druntime#2220"

@dlang-bot dlang-bot added the Bug Fix Include reference to corresponding bugzilla issue label Jun 18, 2018
@schveiguy
Copy link
Member Author

ping @MartinNowak this should go into 2.081.0, it's a regression.

@schveiguy schveiguy added the Regression PRs that fix regressions label Jun 18, 2018
@wilzbach
Copy link
Contributor

@schveiguy as long as it's targeted on stable (which it is) and merged before the end of this month, it will be part of the final 2.081

Copy link
Member

@rainers rainers left a comment

Choose a reason for hiding this comment

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

LGTM. The documentation in core.memory also states that nothing happens for null or unknown pointers.

The implementation is still slightly different, because the GC does not remember adding a root or range twice, so a single removeRoot/Range can lead to subtle bugs. ProtoGC remembers identical roots/ranges multiple times, so might keep them alive longer.

@schveiguy
Copy link
Member Author

ProtoGC remembers identical roots/ranges multiple times, so might keep them alive longer.

That's a simple fix as well, just don't return :)

@schveiguy schveiguy closed this Jun 18, 2018
@schveiguy schveiguy reopened this Jun 18, 2018
@schveiguy
Copy link
Member Author

I think jenkins wasn't coming back with a test, apparently you have to close and reopen.

@wilzbach
Copy link
Contributor

@schveiguy ci.dlang.io is currently down. It will never reply.

@schveiguy
Copy link
Member Author

Hm... so I guess I'll use the auto-tester to merge. Thanks for the update.

@schveiguy
Copy link
Member Author

Auto-merge toggled on

@wilzbach
Copy link
Contributor

Hm... so I guess I'll use the auto-tester to merge. Thanks for the update.

That won't help you, because it can't merge when there are required CI checks that haven't passed yet.
I do have admin access and can still merge this pull request (exactly for these cases).
I will do this for this PR now.
I hope that ci.dlang.io gets back online soonish, but I haven't heard back from Martin.

@wilzbach wilzbach merged commit 90c140f into dlang:stable Jun 18, 2018
@schveiguy
Copy link
Member Author

Ah thanks, I was confusing this case with the one where the bot won't merge when non-required CIs haven't reported.

@schveiguy schveiguy deleted the fix18996 branch June 18, 2018 18:37
@rainers
Copy link
Member

rainers commented Jun 18, 2018

That's a simple fix as well, just don't return :)

Yes, but I think the returning API is much saner. If you have two independent sources that happen to add the same root/range, it is very likely that the root/range is still in use after one source has released it.

@schveiguy
Copy link
Member Author

If you have two independent sources that happen to add the same root/range, it is very likely that the root/range is still in use after one source has released it.

Agreed. So maybe it's the conservative GC that needs updating.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Bug Fix Include reference to corresponding bugzilla issue Regression PRs that fix regressions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants