If anyone actually reads this, here’s an unusual circumstance to look out for… circular object references that cause Pry to go BSC.
(For those who don’t know, Pry is a Ruby shell that can be used as a replacement for the default Ruby shell, IRB (like IPython for python people).)
Today I witnessed a pretty strange phenomenon where I had a game board that contained a bunch of objects representing items on the board. Each item involved in the game also contacted a reference back to the game board. After building this circular awareness we starting having problems with Pry where it would just flat out lock up and tax the CPU like crazy.
After some investigation we narrowed things down to the inspect method and the fact that whenever a statement in pry is executed (and irb too… I think) the inspect method is called on it. This ultimately gives you the nice visual representation of your objects we all love.
After some investigation and soliciting help from peers it looks like this was probably caused by the fact that the game board object referenced other game objects that in turn referenced the game board…. and so on…
In the past, this has NEVER been a problem for me, and later in the day I wasn’t about to reproduce it with different code… the situation today definitely caused a problem and wasted at least 30 minutes. 🙁