0

We are running an application using Forge Design Automation for Revit and have an issue I can't fully explain. Our tests have been working just fine but we got a couple lately that seem to freeze inside Revit as far as I can tell. Here is the OnStartup method of my external application:

    public ExternalDBApplicationResult OnStartup(ControlledApplication application)
    {
        SharedData.Initialize(new LoggerConsole());
        // Startup is only for registering the DA ready event
        SharedData.Log.AddLine("Design automation startup in App");
        DesignAutomationBridge.DesignAutomationReadyEvent += DesignAutomationBridge_DesignAutomationReadyEvent;
        SharedData.Log.AddLine("Design automation event registered");
        return ExternalDBApplicationResult.Succeeded;
    }

Here is the outline of the event handler referenced:

    void DesignAutomationBridge_DesignAutomationReadyEvent(object sender, DesignAutomationReadyEventArgs e)
    {
        // Start the actual processing here
        SharedData.Log.AddLine($"Into automation ready event, working directory is: {Environment.CurrentDirectory}");

       ...Other Code...
    }

The log for one of the jobs I'm talking about (clipped to relevant portion) looks as follows:

[12/10/2020 01:34:42] Design automation startup in App
[12/10/2020 01:34:42] Design automation event registered
[12/10/2020 01:34:42] Initialize and  get RCE: (VersionBuild) 21.1.10.26 (VersionNumber) 2021 (SubVersionNumber) 2021.2
[12/10/2020 04:34:33] Error: Revit Core Engine Core Console is shut down due to process time limit.
[12/10/2020 04:34:33] End script phase.

As you can see, it makes it to the log line about event registered so the only thing left to do after that is return success. It does seem to get that success because the next log line is from inside Revit (the one that starts with 'Initialize and get'). Then after that it seems to wait 3 hours and then error because of time out. It never logs the very first line of the event handler so as far as I can tell that's not getting called.

Anyone else experienced this? How would you even go about debugging it?

sfaust
  • 2,089
  • 28
  • 54
  • 1
    could you provide WorkItem Id of failed job? so we can check and may get more info. As for debugging, do you try this [local debugging tool](https://github.com/Autodesk-Forge/design.automation-csharp-revit.local.debug.tool)? – Emma Zhu Dec 10 '20 at 21:57
  • Job information object from the log shows this: "Id":"a646ea48200b47748599b80071c5adff" I assume that's the work item ID right? I have used the local debug tool and it seems to run fine there in all my tests. I don't have the model from the user to test on but again, from what I can see it's not my code that's running during the freeze. – sfaust Dec 10 '20 at 22:17
  • Yes, "a646ea48200b47748599b80071c5adff" is the WorkItem Id. Unfortunately, we can't get more info in our log. One common reason for hanging is some UI is triggered. Could you test the model from user, or ask the user to open the input model locally to see if some UI shows up? – Emma Zhu Dec 10 '20 at 23:29
  • The UI issue is the first thing I thought of but I'm pretty certain that isn't it. As mentioned based on the logs it completes the OnStartup method and the next line of our code that should run is a log line in the event handler and that is never hit so I don't see how there is anything UI related coming from our code... I'll check with the user though. – sfaust Dec 11 '20 at 15:18
  • As a related question, can you lower this timeout limit or is it hard coded? Our functions should not take more than 5-10 minutes in most cases and 30 minutes for super large models so it would be nice to set a timeout of 45 minutes or an hour instead of letting it just sit there for 3 hours... – sfaust Dec 11 '20 at 15:26
  • If you have input(that is the case here), we open the model and pass the Document to the addin to process. It is possible the opening triggered UI. UI is one common reason for hanging we want to check first. If it is not, we need more investigation then, the logging doesn't show much as I explained above. – Emma Zhu Dec 11 '20 at 16:03
  • You can customize the timeout limit in the WorkItem payload via [**limitProcessingTimeSec**](https://forge.autodesk.com/en/docs/design-automation/v3/reference/http/workitems-POST/). 3 hours is a default one if no limitProcessingTimeSec provided in the payload. You can also [override this limit at engine level](https://forge.autodesk.com/en/docs/design-automation/v3/reference/http/servicelimits-owner-PUT/) – Emma Zhu Dec 11 '20 at 16:14
  • Ok got the timeout setting so thank you for that. I heard back from the user though and there is no UI that comes up when opened locally. – sfaust Dec 16 '20 at 16:53

0 Answers0