PyOpenCL kernel not returning

I'm playing with PyOpenCL for the first time, by writing a ray tracer, real original. I'm encountering an interesting issue where sometimes my opencl kernel does not close. For a while it was "fixed" by introducing a printf statement into the ray color function. Honestly I'm not sure where the offending code is which makes it hard to post a minimal example of my problem. here is my github repository containing the code.

I'm not even sure where to start debugging seeing how this is my first time using this technology.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum