Error message gives no clue for cause

unhandled

#1

I am hunting down what is causing the display of this error message, but there really is no clue as to what causes this, except that, unless I check “Do not show this message again”, it keeps popping up.
Also, after discarding the message, the definition essentially freezes.
This could be related to the “fix” for the recent crashes, because that definition didn’t freeze like that ; it just worked until it crashed Rhino.

If this is caused by something bad in my definition, my only investigation method is to :
-Lock the canvas
-Open the definition
-Disable a part of my definition
-Unlock
-See if the error message pops up
-If it does, start again and disable more components until the origin of the problem can be singled out

This method has worked for me in the past, but I really wish the “Breakpoint call stack” (whatever that is) gave me simple information about what causes the issue.


(Riccardo Majewski) #2

It is really difficult to suppose the problem without the file.
Can you attach the file here?
(and if it point to any rhino geometry, attach it too)


#3

Hi Riccardo,

My post is not about solving a particular issue, but rather to point out a weakness in the way errors are reported by GH.
The definition in question is a behemoth, and certainly not something I can share.


(David Rutten) #4

If the error message is to be believed (An object expired during a solution) then something is triggering updates inside updates. There’s two ways in which this typically happens:

  1. A component is listening to events or callbacks from processes other than Rhino or perhaps a web-based data exchange and triggering updates in Grasshopper without going through the proper channels, i.e. it doesn’t wait for any current solution to complete, it just waltzes in and starts making coffee while someone else is busy cooking a meal in the same kitchen. This is a threading issue.
  2. A component is updating itself or other components from within a solution. This is a recursion issue.

You shouldn’t be able to do anything that would cause this, it requires code. So either a script component or a GHA component.

I agree the message is pretty summary and could do with some beefing up, but on the other hand the component which is expiring is not necessarily the one at fault. Still, more information is always better than less information.

The fact that the process gets stuck after you dismiss the message tells me that something is stuck in a loop causing one update after another. Again that requires custom code.

I’ve logged an issue under RH-46662 to display more data in the error, maybe that will help us figure out what’s going on.


#5

Hi David, I suspect this is linked to an issue I have with a Human UI button which should only output “True” when pressed, but in fact remains “stuck” .
Visually, it looks like it is in the “not pressed” state though.
Here’s my post on this issue.


(David Rutten) #6

Actually the fact that there isn’t any information inside the stacktrace seems to be a clue in and of itself. The way I designed this error dialog is that it post-pones gathering information about what went wrong until after it’s definitely running on the UI thread. Which is probably too late and in the wrong context.

If I replicate the problem using the recursive approach, I get the following (with already improved messaging):

From this I can work out that there’s a script component calling the OnSolutionExpired method during a solution which is the illegal bit.

I’ll have to refactor the reporting so that it first collects all relevant data and only then switches to a UI thread context.


Edit: I can confirm that if the offending code is running on a non-UI-thread, the callstack is indeed empty. I'll fix this.

(David Rutten) #7

Illegal activity originating in threads is now handled better, although it is in the nature of threads that it can be really hard to figure out who set the ball rolling…


#8

I am beyond flabbergastedness…
How can you do stuff so fast ?
I’m not sure if it will help ME find the exact origin of the problem, but maybe a smart individual…


(matthew) #9

Hi David-

I’m encountering case 1 (using web to trigger updates). I’m new to writing GH components, can you point me to a resource that explains how to trigger that update in the proper way? Thanks for all your work.