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

Investigate re-entrant Properties #298

Closed
samreid opened this issue Sep 4, 2018 · 5 comments
Closed

Investigate re-entrant Properties #298

samreid opened this issue Sep 4, 2018 · 5 comments
Assignees

Comments

@samreid
Copy link
Member

samreid commented Sep 4, 2018

In phetsims/axon#179 we identified Property instances that are re-entrant. In this context, re-entrant means a change in value of the Property causes (via listeners) another change in the value of the same Property instance.

Re-entry can occur for at least 3 different reasons, which are document here: phetsims/axon#179 (comment)

value=0.9999999999999998, oldValue=1 // epsilon problem
value=-0.4277580409572783, oldValue=-0.5 // large delta problem
value=[Object], oldValue=[Object] // object changed to object problem.  May be same object?

This issue is to search through the Properties with reentrant: true and:

(a) confirm that the Property really requires reentrant: true
(b) identify the reason for the reentry (may be one of the 3 classes above)
(c-i) see if the code can be rewritten so it no longer requires a reentrant Property, or document why the code uses a re-entrant Property
or
(c-ii) document why the code uses a re-entrant Property

Initially assigning to the responsible-dev for this repo, though it is unclear what the priority should be for this issue.

@samreid samreid self-assigned this Sep 4, 2018
@samreid
Copy link
Member Author

samreid commented Sep 11, 2018

You can reproduce this problem by temporarily changing reentrant to false, then dragging the leg and pressing reset. The stack trace goes through a DynamicProperty, which I traced to AppendageNode. If you make that DynamicProperty bidirectional: false then the re-entry problem goes away.

@samreid
Copy link
Member Author

samreid commented Sep 11, 2018

I also noticed there is a comment about this in the DynamicProperty:

// only update angle if we are not mouse dragging to avoid reentrance

@jessegreenberg can you please look into this issue?

@samreid samreid assigned jessegreenberg and unassigned samreid Sep 11, 2018
@jessegreenberg
Copy link
Contributor

A related issue recently came up in #330. I am unable to reproduce the reentrance on master when I remove reentrant from angleProperty and the relevant lines in inverseMap of DynamicProperty. I can however reproduce the issue when I checkout SHAS from around the date of this issue. So this may have been fixed by other commits in this repo, Ill investigate.

@jessegreenberg
Copy link
Contributor

I think I found it, there was an issue with AccessibleSlider identified in phetsims/gravity-force-lab-basics#72 and the general fix made it so that this is no longer reentrant. I will remove reentrant: true and other references here and test to make sure reentrance is no more while everything still works.

@jessegreenberg
Copy link
Contributor

reentrant: true removed and sim is passing fuzz tests and a11y features are working. I can't reproduce the problem when going through steps in #298 (comment). Lines and documentation in #298 (comment) were removed. Closing.

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

No branches or pull requests

2 participants