-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NullPointerException: "frame" is null #41
Comments
Thanks for reporting, is this only happening in the most recent version? |
@cansik It was happening with the last version, so I checked here and saw the update, so I tried upgrading the realsense-processing jar. But the behavior is similar. The first error always seems to be the null public short[][] getDepthData() {
this.checkRunning();
DepthFrame frame = this.frames.getDepthFrame(); // <- this is null
this.depthStream.updateDepthData(frame);
frame.release(); // <- and NPE happens here
return this.depthStream.getData();
} But the second error noted above has been happening more with the new library. I might be seeing less hard crashing now, which was coming with an error log, found below (this was with the older version - I'm testing the new one right now)
|
Ok, I hope I can have a look at it this weekend. |
This may seem a little crazy, but I've added a bunch of defensive checks for null frame data in this commit. This has made a big difference so far! After switching to my updated RealSenseProcessing.jar, It still seems like there can be an occasional error noted in my original Issue ☝️ , but they're almost completely gone, especially for how many errors I was seeing! Thank you for making this library so easy to build, and for all of your work 🙏 Everything seems to be working normally - let me know if you'd want a PR. Maybe I'm only seeing these errors because I run the Realsense updates in a thread? I believe that I have to use a Thread to keep my app running at 60fps. For some reason this is mostly only happening on the PC that I've launched the project on - I don't see many of these errors on my own PC, but I have noticed them occasionally on past projects. |
Also, I wish I knew which null check solved my problem. I started small, in the |
Okay, after a bit of observing, the frame == null exception hasn't happened again 🙌 I've seen a few more of the following error, but I haven't had any hard crashes 🤞
I've also caught several NullPointerExceptions using this portion of my code, but my app keeps running 🙌 I'll try to find a stack trace for these and maybe add another null check in the library code.
To be continued... |
Wow thanks for the in-depth investigation, a PR would be great of course. I would be happy to review and merge it. |
I was still getting this error relatively frequently, but was handled without problem by a try/catch:
I've looked into it and added better null checks. I'm testing now and haven't seen any errors yet. I've pushed another commit and started a PR. Let me know what you think, and thank you! |
Thanks for the PR, could you give the released version a try and tell me if it works now as expected? |
I have switched to this official release in my project that was previously seeing many errors each day. I've now run for 24 hours with zero errors 🎉 I've also tested some of my local demos just to make sure other features look right. I'll let you know if any issues come up. Thank you for this library and your continued support! I couldn't build my projects without it 🥇 |
@cacheflowe That sounds great, I have updated the contribution link as well 🙌🏻 Looking forward to your new projects ✨ |
Hello!
I'm getting this error consistently on Windows 11 with the latest Processing, the new realsense-processing library (2.5.0), and the D415 with the latest firmware. Is there any way to override and protect against this error?
I'm running the Realsense update in a Thread, described below. I only start a thread if the previous frame has completed. I've used this code for a long time across projects but am seeing lots of crashes on my current project.
Here's my code:
I also start seeing other errors after a while:
Thank you!
The text was updated successfully, but these errors were encountered: