himanshukandwal / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 0 forks source link

JNI Crash #5

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. When I make repeated calls to cvHaarDetectObjects(), it will eventually 
crash.

What is the expected output? What do you see instead?
I expect it to return a CvSeq object, but instead it will crash.

What version of the product are you using? On what operating system?
I am using the latest version of the product, and I have tried it on both 
Windows and MacOS X. 
While the actual output of the error on each machine is slightly different, the 
problem is in the 
same location.

Please provide any additional information below.
I have attached the code that I am using (FindFaces.java), which is rather 
straightforward. Also, I 
have included the error logs that were produced on the Windows machine as well 
as a mediocre 
one I generated from the Mac OS X machine. They are the same physical machine. 

This may be related strictly to JNI, but I wanted to post here before I went 
there.

Original issue reported on code.google.com by jpjenkin...@gmail.com on 18 May 2010 at 10:50

Attachments:

GoogleCodeExporter commented 8 years ago
It seems to crash trying to free a CallBack object somewhere.. the only thing I 
can
see is the "new JavaCvErrorCallback().redirectError();" line. Can you try to 
remove
this line and see what happens? Thanks

Samuel

Original comment by samuel.a...@gmail.com on 19 May 2010 at 4:33

GoogleCodeExporter commented 8 years ago
That appears to have fixed it. I will reopen if it begins happening again, but, 
for now, it appears to run perfectly.

Thank you very much. 

Original comment by jpjenkin...@gmail.com on 19 May 2010 at 5:38

GoogleCodeExporter commented 8 years ago
Ok, that's good, but it should not happen with the error callback in place 
either...
What version of JNA are you using?

Samuel

Original comment by samuel.a...@gmail.com on 20 May 2010 at 12:37

GoogleCodeExporter commented 8 years ago
3.2.4 (b0)

Here is the Manifest file:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 1.5.0_20-141 (Apple Inc.)
Main-Class: com.sun.jna.Native

Name: com/sun/jna/
Implementation-Title: com.sun.jna
Implementation-Vendor: JNA Development Team
Implementation-Version: 3.2.4 (b0)
Specification-Title: Java Native Access (JNA)
Specification-Vendor: JNA Development Team
Specification-Version: 3

Original comment by jpjenkin...@gmail.com on 20 May 2010 at 12:45

GoogleCodeExporter commented 8 years ago
Hum, maybe it has been fixed with 3.2.5? Let me know if it causes the same 
issue with
3.2.5, and I will look further into it, thanks

Samuel

Original comment by samuel.a...@gmail.com on 20 May 2010 at 12:47

GoogleCodeExporter commented 8 years ago
Still had the same problem with 3.2.5; I have attached the dump. 

For now, I am going to just comment the line out since this is only for 
research. If you want, I can continue 
testing new versions of JavaCV given that I can easily recreate the crash. I 
cannot guarantee immediate 
responses, but I will try to get to it as soon as I can. Also, I will probably 
be putting my entire project on Google 
code at the end of the quarter, so you can have it then for your own testing.

Original comment by jpjenkin...@gmail.com on 20 May 2010 at 1:26

Attachments:

GoogleCodeExporter commented 8 years ago
I believe it has to do with the "new JavaCvErrorCallback().redirectError();" 
being called every time the function is 
called (about 5 times). I now have it placed in a constructor that is only 
called once, and I don't seem to be 
having the problem anymore. I may try creating several of these objects and see 
if that reproduces the problem, 
but that may not be until later this week.

Original comment by jpjenkin...@gmail.com on 22 May 2010 at 2:37

GoogleCodeExporter commented 8 years ago
Thanks for the followup. I figured out that the crash occurs because of a bug 
in JNA
with the garbage collection of a Callback object:
https://jna.dev.java.net/servlets/ReadMsg?list=users&msgNo=4009
But as you say, JavaCvErrorCallback is supposed to be created once and never get
garbage collected, so it should work fine yes.. marking this issue as done, and 
we'll
see if I find the related problem in JNA :)

Samuel

Original comment by samuel.a...@gmail.com on 22 May 2010 at 6:43