BHoM / BHoM_UI

GNU Lesser General Public License v3.0
9 stars 5 forks source link

Grasshopper freeze on startup #305

Closed IsakNaslundBh closed 3 years ago

IsakNaslundBh commented 4 years ago

Description:

Not sure if this is a UI issue or a GH issue, but raising here as most code is centralised.

In some occasions, Grasshopper freeze on startup Looking like this: image

Trying to start it again makes GH load up but with limited functionality. For example:

Restarting Rhino and Grasshopper everything again runs with no issue

Steps to reproduce:

Will try to keep an eye out for when this is occurring, but has only happened a few times and have still not been able to spot a pattern.

al-fisher commented 4 years ago

I just experienced the exact same behaviour.

adecler commented 3 years ago

After closing and reopening GH as many times as I could handle, I was not able to reproduce the bug. Next time, can you hook up Visual Studio and check where the process is hanging ?

adecler commented 3 years ago

Looking at this again, I see there is no progress bar under the Grasshopper splash screen. Was that progress bar present at any time ? Not sure about you but the BHoM is usually one of the last plugin that GH is loading so a bit surprising not to see a progress bar at all.

If there was never a progress bar, the only thing I can think of is that some of the pre-processing GH does before loading the plugins (and displaying the progress bar) is causing it to hang. Very weird though as I cannot really of something that would cause it work sometimes and sometimes not. Also unclear why it doesn't happen on my machine despite me having probably open and closed GH more than anyone during the UI development.

IsakNaslundBh commented 3 years ago

Looking at this again, I see there is no progress bar under the Grasshopper splash screen. Was that progress bar present at any time ? Not sure about you but the BHoM is usually one of the last plugin that GH is loading so a bit surprising not to see a progress bar at all.

For me there was a progress bar that filled up and went through all the plugins. This freeze happened after it had filled up. Basically, the progress bar filled up completely, then disappeared, frozen on the screen on the snip.

It does not happen regularly at all for me, just at rare occasions. I wonder if it has anything to do with the log files (do not have anything to back this up, just that that is the only major new thing added I can think of)? I have been opening and closing both rhino+GH and excel multiple times throughout the days, not sure if it is some combination of that causing it?

alelom commented 3 years ago

It does not happen regularly at all for me, just at rare occasions.

Same here. I had this only twice yesterday.

For me there was a progress bar that filled up and went through all the plugins. This freeze happened after it had filled up. Basically, the progress bar filled up completely, then disappeared, frozen on the screen on the snip.

Same. For me, when grasshopper finally opened, components in a script I opened couldn't load, and the CTRL+SHIFT+B menu didn't work.

adecler commented 3 years ago

PR raised here: #306.

Feel free to add yourself as a reviewer if you also have the problem.

IsakNaslundBh commented 3 years ago

So, got the error again, whilst on debug on GH, UI, Excel and Dynamo.

Tried attaching both GH and UI, but end up in this screen:

image

Will turn on Native debugging on BHoM_UI and GH and rebuild and check if that means I can get access if I get this again.

I forced open GH again, by hitting the GH load button one more time, and had a look at raised events. I got this:

image

Seem to be complaining abot loading types from a significant portion of the engines. Have serialisaed out the log files here:

20200921-WarningsOnStartEvents.zip

In case useful. Worth noting that the Reflection_Engine, which is currently executing, is naturally not in the list. Wonder if the dynamic loading of the dlls is somehow playing up, at least when extracting all of the types?

GetInfo component might help, as showing up with some error:

image

Another point, not sure if helping in terms on whats going on:

CreateObejct and Create request are not working at all, can not even drop on the canvas, unless

After that the CreateObejct component DO start working.

Will continue to have a look out!

IsakNaslundBh commented 3 years ago

So, did happen again. This time I was on the https://github.com/BHoM/BHoM_Engine/pull/2002 branch, so got a bit more message information.

20200921-WarningsOnStartEvents2.zip

Some digging on the web together with @alelom and @al-fisher found some references to potential race conditions. As the BHoMAnalytics is using the serialiser engine, which is loading up all methods/types at the same time as BHoM_UI is being loaded up, this seems like a possible cause for the issue, as none of those methods are threadsafe.

Have raised an issue on the reflection_Engine here: https://github.com/BHoM/BHoM_Engine/issues/2003 and will raise a PR, putting padlocks in place around the Methods returning MethodLists as well as TypeLists.

adecler commented 3 years ago

All, can you confirm that this bug has now been solved by the last PR ?

Please, reopen this issue if you still experienced the problem.

IsakNaslundBh commented 3 years ago

Have not had the issue since the lock fix. Given that it only happened at rare occasions, I can not be 100% sure, but will reopen this issue if it happens again!