Nasty Bug using ofxOpenNI - EXC_ARITHMETIC signal thrown

Hi everyone,

I’m working on an installation and using ofxOpenNI for skeleton tracking of multiple users. I’ve run into an issue that is frustratingly hard to replicate but happens often enough that I need to address it.

I get an EXC_ARITHMETIC signal thrown when ofxOpenNI tries to update the user generator in ofxOpenNI.cpp:

if(g_bIsUserOn && (g_User.IsNewDataAvailable() || g_bIsPlayerOn)){

It seems to happen when a user (or multiple) are dropped and added at the same time. When I’m testing by myself, it happens sometimes when I step too close to the kinect. I can’t seem to do anything about it!

The only reference I’ve seen to the issue online is here: but it’s in Japanese and using google translate, it seems like they didn’t figure it out either.

Any ideas on how to handle this? Thanks, any help is very much appreciated.

EDIT: I should also note that I made the small change outlined in this pull request: and it helped manage the users much better, but may be contributing to the error.

Might be a silly race condition. Have you seen the “setSafeThreading” feature ? If you look for at the meaning of the signal, it might be a division by zero ; maybe something like going through the array of user modulo the total number, but if the total number is 0, boom!

Hey thanks for the reply. I had tried the setSafeThreading and it slowed my app to a crawl, unfortunately. And I agree, I’m pretty sure its a divide by zero looking at the total number of users. For now, unless I (or someone else!) have a better idea, I’m just going to write a little watchdog script to run with my app and check for a freeze or crash and restart.