It sounds to me like the C code is crashing the VM process that
BackgroundRB is running in. If this is intermittent then it may be
data specific to what you are working with. It sounds like you need
to do some additional debugging of the BackgroundRB code being
executed. Put in tracing of basic execution paths and input data so
you can narrow down where the crashes are happening.