SystemStackError


#1

I downloaded the new SU Make 2015. I am now getting an error in the Ruby Console for one of my plugin routines.

Error: Unable to get backtrace for SystemStackError

Any ideas what can cause this? It may very well be my coding but it didn’t occur in 2014.


#2

Then you have to narrow down what is causing it. I have no idea and am not very good at stabbing into the dark without more hints (code). It indicates a stack overflow, like caused by recursion, but you say it didn’t occur in SU2014.
Try to disable parts of your plugin (bisecting) to find in what part SketchUp produces the message, then create a generalized example.


#3

hm… The Ruby core remained the same in SU2015 - so there should be no change to affect that. But do you have some code we can look at?


#4

Does the error message at least give a ruby script filepath and line number ?


#5

If you know what ruby method is calling it, then at the end of the method, you can ADD a rescue clause thus:

rescue SystemStackError => e
  MyModule::MyPlugin::ErrorHash[:methodname]= e
  # other code to recover gracefully. or notify
  # the user that the action cannot be performed
end # methodname() defintion

If you have a general rescue clause, the specific ones need to be inserted above it.

This assumes you create a hash at the top of your module to store exceptions.

module MyModule::MyPlugin
  ErrorHash ||= {}

You can include such debugging features that you keep in a separate Debug module, using the include() method.

Then be sure to not to call the backtrace() method if the exception class is SystemStackError.

meth = :methodname
err = ErrorHash[:methodname]
puts("A #{err.class.name} occured in #{meth.to_s}")
if err.class == SystemStackError
  puts("No backtrace possible.")
else
  puts(err.backtrace)
end

If it is you that is trying to store the backtrace array, then use a similar conditional, and store an empty array, (or one with only the "No backtrace possible." string as a member,) if the class is SystemStackError.