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

[Cherry-pick] DYN-2101 Installing ampersand package crashes Dynamo while the graph is open #9951

Merged
merged 9 commits into from
Sep 6, 2019

Conversation

reddyashish
Copy link
Contributor

@reddyashish reddyashish commented Aug 29, 2019

Purpose

This PR is to cherry-pick #9957 into RC2.4.0_master branch.

Declarations

Check these if you believe they are true

  • The code base is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning, and are documented in the API Changes document.

Reviewers

@aparajit-pratap @mjkkirschner @QilongTang

Installing ampersand package crashes Dynamo while the graph is open
foreach (var pkg in enumerable)
{
TryLoadPackageIntoLibrary(pkg);
}

// Setting back the DisableRun property back to false, as the package loading is completed.
EngineController.DisableRun = false;
Copy link
Member

Choose a reason for hiding this comment

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

is there ever a case where we could accidentally turn runs off and then never turn them back on?

Copy link
Contributor Author

@reddyashish reddyashish Aug 30, 2019

Choose a reason for hiding this comment

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

I don't think so as this would be set back to false, once the package loading is completed. I did not run into any such case.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think @mjkkirschner was alluding to a case where an exception is thrown from TryLoadPackageIntoLibrary and this flag-reset step is skipped in that case. I think TryLoadPackageIntoLibrary has a try-catch inside it that can catch any exception and not rethrow it in order for this flag reset to take place right after but to be safe we can have another try-catch-finally around the for loop and reset the flag in the finally block to ensure it always happens no matter what.

Copy link
Member

@mjkkirschner mjkkirschner Aug 30, 2019

Choose a reason for hiding this comment

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

@aparajit-pratap thats exactly what I was thinking - do you think it's worth doing this:
or should it be okay since TryLoadPackageIntoLibrary will already catch and move onto the next package?

Suggested change
EngineController.DisableRun = false;
try {
foreach (var pkg in enumerable)
{
TryLoadPackageIntoLibrary(pkg);
}
}
finally{
EngineController.DisableRun = false;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

It would at least be worthwhile checking that the exception caught inside TryLoadPackageIntoLibrary is not re-thrown from the Log methods?

Copy link
Member

Choose a reason for hiding this comment

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

log doesn't seem to rethrow anything.

@mjkkirschner
Copy link
Member

@reddyashish can you write a simple test that asserts the flag is updated to the correct state while packages load and then set to the correct state afterwards? You can likely just use the packageLoader tests for this.

@mjkkirschner mjkkirschner added the PTAL Please Take A Look 👀 label Aug 30, 2019
@mjkkirschner
Copy link
Member

@reddyashish - does this change make the loading of packages faster? Since we are no longer executing the graph a number of times related to the number of custom functions present in the graph?

@reddyashish
Copy link
Contributor Author

Added the test. Please take a look

@reddyashish
Copy link
Contributor Author

reddyashish commented Aug 30, 2019

@mjkkirschner It would definitely reduce the number of executions when the graph is in automatic mode. If the graph is in manual mode, there would be no difference as the run's are not triggered anyways. so I would say yes. Not sure if we can validate it using the performance benchmark.

/// A followup task is added https://jira.autodesk.com/browse/DYN-2120 to refactor the approach to this solution.
/// This test needs to be modified in that case.
[Test]
public void PackageLoadExceptionTest()
Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Member

Choose a reason for hiding this comment

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

can you add category as well:
TechDebt

@mjkkirschner
Copy link
Member

mjkkirschner commented Aug 30, 2019

I think as it is if we cannot find a better solution this looks good as a patch fix for the regression - @aparajit-pratap have you had a chance to consider alternatives?, I am also looking but nothing lower risk has turned up yet.

@reddyashish reddyashish changed the title DYN-2101 Installing ampersand package crashes Dynamo while the graph is open [Cherry-pick] DYN-2101 Installing ampersand package crashes Dynamo while the graph is open Sep 3, 2019
@QilongTang QilongTang merged commit 5540aaa into DynamoDS:RC2.4.0_master Sep 6, 2019
@reddyashish
Copy link
Contributor Author

Merging this

@horatiubota horatiubota added the error/warning/crash Issues mentioning a Dynamo error, warning or crash message label Nov 11, 2019
@reddyashish reddyashish deleted the 2.4 branch November 23, 2022 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error/warning/crash Issues mentioning a Dynamo error, warning or crash message PTAL Please Take A Look 👀
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants