-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
MAC OS Snow leopard issue. #26
Comments
Hi @alanheppenstall, Can you try the same with latest version, which is 0.3.7 (not beta as in provided example)? Please let me know if it's reproducible. |
Hi @sarxos , thanks for getting back to me! With that version (all the JARs added to the build in place of the beta) I got:
And with slf4j-simple-1.7.2.jar added (is that correct?) I get:
|
Ok, so if the problem is reproducible in 0.3.7, is it possible for you to prepare threads dump when the program is waiting for webcam to be open? This can be done by the following:
Now use this process ID as the argument to jstack command:
This command will create *.log file containing threads dump which specifies in details which thread is waiting on object monitor. I will need it to locate the problem. |
Here is example of this procedure:
|
Thanks, here it is:
|
Hi, This is dump of the running Eclipse, not the program where Webcam Capture is used. Minimal output from You can also perform some fine tuning and execute the following command to list only those Java processes which include webcam-capture binary:
|
Sorry, that was pretty stupid of me! This should be the right one: 2013-01-28 22:37:45 "Worker-17" prio=5 tid=0000000013416400 nid=0xb2b13000 in Object.wait() [00000000b2b12000] "Process monitor" daemon prio=5 tid=0000000013826000 nid=0xb270b000 in Object.wait() [00000000b270a000] "Input Stream Monitor" daemon prio=5 tid=00000000134f3400 nid=0xb2585000 in Object.wait() [00000000b2584000] "Output Stream Monitor" daemon prio=1 tid=00000000134f2c00 nid=0xb1ef7000 runnable [00000000b1ef6000] "Output Stream Monitor" daemon prio=1 tid=00000000134f2400 nid=0xb1df5000 runnable [00000000b1df4000] "process reaper" daemon prio=5 tid=00000000134f1c00 nid=0xb1cf3000 runnable [00000000b1cf2000] "Worker-16" prio=5 tid=000000001342e000 nid=0xb290f000 in Object.wait() [00000000b290e000] "Attach Listener" daemon prio=9 tid=000000001348e800 nid=0xb2a11000 waiting on condition [0000000000000000] "Worker-13" prio=5 tid=0000000013aa7400 nid=0xb14e3000 in Object.wait() [00000000b14e2000] "Worker-12" prio=5 tid=0000000013308000 nid=0xb17e9000 in Object.wait() [00000000b17e8000] "Worker-9" prio=5 tid=0000000013500400 nid=0xb280d000 in Object.wait() [00000000b280c000] "com.google.inject.internal.util.$Finalizer" daemon prio=5 tid=0000000013290000 nid=0xb2483000 in Object.wait() [00000000b2482000] "[ThreadPool Manager] - Idle Thread" daemon prio=5 tid=0000000013b17c00 nid=0xb21fd000 in Object.wait() [00000000b21fc000] "Device List Monitor" prio=5 tid=000000001348bc00 nid=0xb22ff000 runnable [00000000b22fe000] "Monitor" prio=5 tid=0000000013b0d400 nid=0xb20fb000 runnable [00000000b20fa000] "Worker-6" prio=5 tid=00000000132b1000 nid=0xb1ff9000 waiting on condition [00000000b1ff8000] "Bundle File Closer" daemon prio=1 tid=00000000132a1000 nid=0xb1bf1000 in Object.wait() [00000000b1bf0000] "org.eclipse.jdt.internal.ui.text.JavaReconciler" daemon prio=1 tid=0000000013835800 nid=0xb1aef000 in Object.wait() [00000000b1aee000] "Java indexing" daemon prio=4 tid=0000000013919400 nid=0xb19ed000 in Object.wait() [00000000b19ec000] "Worker-JM" prio=5 tid=00000000131b4800 nid=0xb16e7000 in Object.wait() [00000000b16e6000] "[Timer] - Main Queue Handler" daemon prio=5 tid=000000001317c400 nid=0xb15e5000 in Object.wait() [00000000b15e4000] "Framework Event Dispatcher" daemon prio=5 tid=0000000013126000 nid=0xb13e1000 in Object.wait() [00000000b13e0000] "Start Level Event Dispatcher" daemon prio=5 tid=0000000013123c00 nid=0xb12df000 in Object.wait() [00000000b12de000] "State Data Manager" daemon prio=5 tid=0000000013122400 nid=0xb1101000 waiting on condition [00000000b1100000] "Framework Active Thread" prio=5 tid=000000001311d000 nid=0xb0faa000 in Object.wait() [00000000b0fa9000] "Poller SunPKCS11-Darwin" daemon prio=1 tid=0000000013861800 nid=0xb0e1d000 waiting on condition [00000000b0e1c000] "Low Memory Detector" daemon prio=5 tid=00000000130bdc00 nid=0xb0c19000 runnable [0000000000000000] "C1 CompilerThread0" daemon prio=9 tid=00000000130bcc00 nid=0xb0b17000 waiting on condition [0000000000000000] "Signal Dispatcher" daemon prio=9 tid=00000000130bbc00 nid=0xb0a15000 runnable [0000000000000000] "Surrogate Locker Thread (Concurrent GC)" daemon prio=5 tid=00000000130bac00 nid=0xb0913000 waiting on condition [0000000000000000] "Finalizer" daemon prio=8 tid=00000000130ae800 nid=0xb0811000 in Object.wait() [00000000b0810000] "Reference Handler" daemon prio=10 tid=00000000130ad800 nid=0xb070f000 in Object.wait() [00000000b070e000] "main" prio=6 tid=0000000013000c00 nid=0xa0c44540 runnable [00000000bfffe000] "VM Thread" prio=9 tid=0000000013803c00 nid=0xb060d000 runnable "Gang worker#0 (Parallel GC Threads)" prio=9 tid=0000000013002800 nid=0xb0307000 runnable "Gang worker#1 (Parallel GC Threads)" prio=9 tid=0000000013003800 nid=0xb0409000 runnable "Concurrent Mark-Sweep GC Thread" prio=9 tid=000000001306e400 nid=0xb050b000 runnable "Exception Catcher Thread" prio=10 tid=0000000013000800 nid=0xb0205000 runnable |
Hi, it's not the right one again ;P Please take a look on the stack traces in the threads. None of Webcam Capture classes is available there, but plenty of those from Equinox (OSGi runtime on which Eclipse is running). There is also a possibility that your program is not running when you are executing jstack. It will mean that it has been terminated (you should notice "stop" button greyed out in Eclipse). If this is the case the please locate hs_err_pid* file in program working directory. JVM generates it after each crash. I will come back to this issue tomorrow since today it's too late for me and my gf is complaining because I'm sitting at the computer from the early morning ;P |
Sorry, I've now worked out the issue with log4j and should be able to see a useful stack trace. Console output: [AWT-EventQueue-0] INFO com.github.sarxos.webcam.WebcamDriverUtils - Searching driver com.github.sarxos.webcam.ds.openimaj.OpenImajDriver I can't seem to get anything from jstack. The process is still running (red stop button in eclipse) and the webcam capture UI is stuck on 'Initialization'. Using the grep to look at any java processes only throws up two processes, neither of which are the WebcamCapture process. How odd. Thanks for all the time you're putting in, it's much appreciated and I'm sorry to cause you more work! |
Hi, Sorry to be late. I was pretty busy and was not able to check this issue. I prepared small program to verify one option. Could you please run it on your Mac? You have to download all required JARs compressed in single ZIP file from here and add them to the classpath when running test program. Code to be tested: This should capture single image and store it in test.jpg in working directory (use F5 to refresh project in your Eclipse workspace for file to appear after you run this program). import java.awt.image.BufferedImage;
import java.io.File;
import java.util.List;
import javax.imageio.ImageIO;
import org.openimaj.image.ImageUtilities;
import org.openimaj.video.capture.Device;
import org.openimaj.video.capture.VideoCapture;
public class Test1 {
public static void main(String[] args) throws Throwable {
List<Device> devices = VideoCapture.getVideoDevices();
System.out.println(String.format("Found %d devices", devices.size()));
for (Device device : devices) {
System.out.println(String.format("Create video capture for device %s %s", device.getNameStr(), device.getIdentifierStr()));
VideoCapture capture = new VideoCapture(320, 240, device);
System.out.println("Create buffer");
int i = 0;
do {
capture.getNextFrame();
System.out.println("wait...");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
} while (++i < 3);
System.out.println("Get image");
BufferedImage img = ImageUtilities.createBufferedImageForDisplay(capture.getCurrentFrame());
System.out.println("Stop capture");
capture.stopCapture();
System.out.println("Close");
capture.close();
System.out.println("Store image in test1.jpg");
ImageIO.write(img, "JPG", new File("test1.jpg"));
}
}
} If this piece works fine and you can check captured image, it means that the problem is located in Webcam Capture API. Otherwise, if program fails, the problem is located in native code from OpenIMAJ project (I'm using their binaries in Webcam Capture default driver). |
Hi, sorry it took me a while to respond, I've had a hectic day too. I ran the test program using the libs provided and that gives me an image that looks normal. Here is the console output: Not enough args for null OpenIMAJGrabber.startSession(int, int, double) What else can I do to help? |
Ok, I think I implement locks in too clever way ;P Let me prepare webcam-capture private release with more logs, especially on fragments I suppose doesn't work, so you can test it with your solution and provide more accurate logs. |
Hi @alanheppenstall, Sorry for getting back to your issue so late. I was pretty busy with project at work. Today I redesigned some of the synchronization features existing in the webcam-capture code with hope it will fix your problem. The code is already available as 0.3.8-beta2. It will not be available in Maven Central, but you can download both JAR and ZIP from here. |
Hi @sarxos, No worries, thank you for getting back to me. I've just tried the jars you provided in 0.3.8-beta2 and seem to get a similar issue: Console: [AWT-EventQueue-0] INFO com.github.sarxos.webcam.WebcamDriverUtils - Searching driver com.github.sarxos.webcam.ds.openimaj.OpenImajDriver I tried jstack but seem to be getting an issue with that: localhost:~ alanheppenstall$ jstack 21987 > stack6.log Jstack normally works so I'm guessing this must be something with the build? |
OK, I've included additional logs in the code to check what is happening inside. Please use this version and provide output. |
Hmmmm, maybe it is now taking images. I've been using the WebcamViewerExample. The console output is: [AWT-EventQueue-0] INFO com.github.sarxos.webcam.WebcamDriverUtils - Searching driver com.github.sarxos.webcam.ds.openimaj.OpenImajDriver |
Mmmm... It seams like several println calls accidentaly synchronized the code ;P Let me try something else - I completely removed synchronization from |
Brilliant! Always makes me wonder how much a lot of println statements can take out of a system. Seems to hang on the initialization again. Console output: [AWT-EventQueue-0] INFO com.github.sarxos.webcam.WebcamDriverUtils - Searching driver com.github.sarxos.webcam.ds.openimaj.OpenImajDriver |
Would it be possible for you to checkout the code and try to debug where thread has stopped? To do that you would have to:
If you agree to dive in the code, then I will submit it to Github, since now it is available only on my Ubuntu laptop. Maybe trace logs revel some secrets, but I'm afraid it will just re-sync code again, as it was observed in previous example... However, to enable trace logs you would have to put this <configuration scan="true" scanPeriod="30 seconds">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern>
</layout>
</appender>
<root level="trace">
<appender-ref ref="STDOUT" />
</root>
</configuration> And calling this one from the code (at the very beginning of main() method: WebcamLogConfigurator.configure("logback.xml"); Please make sure to add logback-classic and logback-core JARs in the classpath. |
Hi, I recently replaced most of the blocking mechanisms to the non-blocking ones. Could you please test it? It should fix your issue. The JAR is available here. If there will be no issues with this version I will release it as 0.3.8. Thank you! |
Hi @sarxos Yep, I seem to be able to run the examples without issues now. Thank you so much for all your help! Is there a donate button anywhere? :) |
Hi. I'm really happy I was able to help you resolve this problem :) I do not have a possibility to perform sanity tests on all supported platforms (such as Mac OS or Raspberry Pi), so I really appreciate time you spent to debug and diagnose this issue :) Yes, there is a donate button available here. Thank you! |
It's not much but I just wanted to show my appreciation. Thanks for your help! Alan |
Thank you Alan, I really appreciate this :) |
I used sarxos lib to capture USB webcam successfully but not to my wireless IP cam. I own DCS-2120 IP cam. Could i use sarxos lib to connect to my IP cam via VPN and how to implement. Waiting for your reply. Thanks! |
Possibly a duplicate of #24 and #8 but with the latest jars from 0.3.7 (http://repo.sarxos.pl/maven2/index.php?dir=com%2Fgithub%2Fsarxos%2Fwebcam-capture%2F0.3.7-beta1%2F) I get the following:
OSx Snow Leopard/Eclipse Indigo/java-6-sun-1.6.0_37 (64bit)
The text was updated successfully, but these errors were encountered: