-
Notifications
You must be signed in to change notification settings - Fork 859
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
SlotMap.compute can lead to deadlock in ThreadSafeSlotMapContainer #1746
Merged
gbrail
merged 10 commits into
mozilla:master
from
nabacg:slotmap-compute-deadlocks-when-redefining-properties
Dec 11, 2024
Merged
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d69afa8
adding PropertyTest redefinePropertyWithThreadSafeSlotMap as a repro …
nabacg 466c6e8
adding minimal Deadlock repro case
nabacg 0ba1f30
spotlessApply
nabacg 8681b19
Change to prevent creation of property descriptors when not required.
aardvark179 0f4e856
Refactor `IdScriptableObject` to avoid building property descriptors.
aardvark179 c14ec1c
Minor style change round if...else cases with `return`.
aardvark179 ad7d0a6
Change `getBuiltInDescriptor` to `getBuiltInDataDescriptor` for clarity.
aardvark179 e20ecb0
moving all getProperty out of slotMap.compute lambda inside Scriptabl…
nabacg d350e81
refactoring LambdaAccessorSlot and corresponding ScriptableObject::de…
nabacg 474c3ba
adding redefine existing property test to LambdaAccessorSlotTests to …
nabacg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, looking at coverage, nothing from line 957 to 961 seems to get covered either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is a little more convoluted: as of right now, I think it's impossible for this code path to be executed, thus it will be challenging to test it. This is because it's only called from
IdScriptableObject::defineOwnProperty
( here and here) and before the call, we've already established thatkey
must be a CharSequence, so it can't a Symbol. So maybe the solutions is to remove this branch?Having said that, this doesn't feel right and perhaps it's an issue with current implementation of
IdScriptableObject::defineOwnProperty
, since it's only handling String (or CharSequence) keys and essentially delegating Symbol key'ed properties to it's base class (ScriptableObject). It's very consistent with howgetOwnPropertyDescriptor
implementation, which does try to find built in descriptor using both Strings and Symbols (here ). I believe this currently works mostly, because we always check base class for property descriptor first, but it's a little confusing why we need that symbol lookup.One could also imagine, someday in the future, someone creating a new built-in
NativeX
class extendingIdScriptableObject
that defines a Symbol keyed property, that's shouldn't be redefined ( i.e.configurable: false
) and current implementation ofIdScriptableObject::defineOwnProperty
would not check it ( only Strings are handled) and allow base class implementation to override it.I appreciate it's a little theoretical, but wanted to share this and ask for opinions on whether we should address this? Also if addressing this deserves a separate PR or should I add it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, thanks -- I suppose one way we could deal with this could be to assert, and in the future if someone wants to implement a subclass that needs it, we'd fix it -- although in many cases we are trying to get rid of IdScriptableObject as it doesn't yield the performance benefit it once did. If you're not comfortable with that, however, I'd also be OK leaving this as it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally wouldn't mind leaving it as is for now, I don't see an obvious place to assert that wouldn't break existing functionality or be completely redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, then I'm satisfied, thanks!