Skip to content
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 on "realtime-image-recognition" #88

Open
neilstevenson opened this issue Nov 7, 2019 · 3 comments
Open

NullPointerException on "realtime-image-recognition" #88

neilstevenson opened this issue Nov 7, 2019 · 3 comments

Comments

@neilstevenson
Copy link
Contributor

The realtime-image-recognition demo gives an NPE

[hz._hzInstance_1_jet.jet.blocking.thread-0] WARN com.hazelcast.jet.impl.execution.TaskletExecutionService - [127.0.0.1]:5701 [jet] [3.2] Exception in ProcessorTasklet{webcam#0}
java.lang.NullPointerException
	at boofcv.io.webcamcapture.UtilWebcamCapture.adjustResolution(UtilWebcamCapture.java:88)
	at boofcv.io.webcamcapture.UtilWebcamCapture.openDefault(UtilWebcamCapture.java:42)
	at WebcamSource.<init>(WebcamSource.java:41)
	at WebcamSource.lambda$webcam$2b1177f1$1(WebcamSource.java:59)
	at com.hazelcast.jet.function.FunctionEx.apply(FunctionEx.java:43)
	at com.hazelcast.jet.impl.connector.ConvenientSourceP.init(ConvenientSourceP.java:106)
	at com.hazelcast.jet.core.AbstractProcessor.init(AbstractProcessor.java:83)
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.init(ProcessorTasklet.java:231)
	at com.hazelcast.jet.impl.execution.TaskletExecutionService$BlockingWorker.run(TaskletExecutionService.java:255)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
[hz._hzInstance_1_jet.cached.thread-3] ERROR com.hazelcast.jet.impl.MasterJobContext - [127.0.0.1]:5701 [jet] [3.2] Execution of job '0365-7398-bac0-0001', execution 0365-7398-bac1-0001 failed after 1,796 ms
com.hazelcast.jet.JetException: Exception in ProcessorTasklet{webcam#0}: java.lang.NullPointerException
	at com.hazelcast.jet.impl.execution.TaskletExecutionService$BlockingWorker.run(TaskletExecutionService.java:270)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
	at ------ submitted from ------.(Unknown Source)
	at com.hazelcast.spi.impl.operationservice.impl.InvocationFuture.resolve(InvocationFuture.java:126)
	at com.hazelcast.spi.impl.AbstractInvocationFuture$1.run(AbstractInvocationFuture.java:251)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
	at com.hazelcast.util.executor.HazelcastManagedThread.executeRun(HazelcastManagedThread.java:64)
	at com.hazelcast.util.executor.HazelcastManagedThread.run(HazelcastManagedThread.java:80)
Caused by: java.lang.NullPointerException
	at boofcv.io.webcamcapture.UtilWebcamCapture.adjustResolution(UtilWebcamCapture.java:88)
	at boofcv.io.webcamcapture.UtilWebcamCapture.openDefault(UtilWebcamCapture.java:42)
	at WebcamSource.<init>(WebcamSource.java:41)
	at WebcamSource.lambda$webcam$2b1177f1$1(WebcamSource.java:59)
	at com.hazelcast.jet.function.FunctionEx.apply(FunctionEx.java:43)
	at com.hazelcast.jet.impl.connector.ConvenientSourceP.init(ConvenientSourceP.java:106)
	at com.hazelcast.jet.core.AbstractProcessor.init(AbstractProcessor.java:83)
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.init(ProcessorTasklet.java:231)
	at com.hazelcast.jet.impl.execution.TaskletExecutionService$BlockingWorker.run(TaskletExecutionService.java:255)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

Steps taken

git clone https://github.com/hazelcast/hazelcast-jet-demos 
cd hazelcast-jet-demos/realtime-image-recognition
mvn install
mvn exec:java

Environment

$ java -version
openjdk version "1.8.0_232"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_232-b09)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.232-b09, mixed mode)

&

$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.15.1
BuildVersion:	19B88

I get the same on OpenJDK 11, and if I change the boofcv dependency to latest (0.34).

I suspect this is related to Catalina.
System Properties doesn't show anything as having requested Camera access.

If this is a Catalina issue, the code should check the O/S prior to starting the job

@neilstevenson
Copy link
Contributor Author

Possibly related, sarxos/webcam-capture#723

eminn pushed a commit that referenced this issue Jan 2, 2020
* Fixes #89

* For #88, does not fix but handle better

* Review comments
@neilstevenson
Copy link
Contributor Author

Tried with latest 0.36.1, now a different error (Catalina 10.15.5, Java 11.0.7+10),
different error

java.util.concurrent.CompletionException: com.hazelcast.jet.JetException: java.lang.RuntimeException: Unknown type.  Value = 0x73726576
    at java.util.concurrent.CompletableFuture.reportJoin (CompletableFuture.java:412)
    at java.util.concurrent.CompletableFuture.join (CompletableFuture.java:2044)
    at com.hazelcast.jet.Job.join (Job.java:137)
    at RealTimeImageRecognition.main (RealTimeImageRecognition.java:127)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:282)
    at java.lang.Thread.run (Thread.java:834)
Caused by: com.hazelcast.jet.JetException: java.lang.RuntimeException: Unknown type.  Value = 0x73726576
    at com.hazelcast.jet.impl.JobCoordinationService.lambda$null$8 (JobCoordinationService.java:320)
    at java.util.concurrent.CompletableFuture.uniHandle (CompletableFuture.java:930)
    at java.util.concurrent.CompletableFuture$UniHandle.tryFire (CompletableFuture.java:907)
    at java.util.concurrent.CompletableFuture.postComplete (CompletableFuture.java:506)
    at java.util.concurrent.CompletableFuture.completeExceptionally (CompletableFuture.java:2088)
    at com.hazelcast.jet.impl.util.NonCompletableFuture.internalCompleteExceptionally (NonCompletableFuture.java:59)
    at com.hazelcast.jet.impl.MasterJobContext.setFinalResult (MasterJobContext.java:493)
    at com.hazelcast.jet.impl.MasterJobContext.lambda$null$19 (MasterJobContext.java:674)
    at com.hazelcast.jet.impl.util.ExceptionUtil.lambda$withTryCatch$0 (ExceptionUtil.java:182)
    at java.util.concurrent.CompletableFuture.uniWhenComplete (CompletableFuture.java:859)
    at java.util.concurrent.CompletableFuture.uniWhenCompleteStage (CompletableFuture.java:883)
    at java.util.concurrent.CompletableFuture.whenComplete (CompletableFuture.java:2251)
    at com.hazelcast.jet.impl.MasterJobContext.lambda$finalizeJob$20 (MasterJobContext.java:670)
    at com.hazelcast.jet.impl.JobCoordinationService.lambda$submitToCoordinatorThread$42 (JobCoordinationService.java:978)
    at com.hazelcast.jet.impl.JobCoordinationService.lambda$submitToCoordinatorThread$43 (JobCoordinationService.java:997)
    at com.hazelcast.internal.util.executor.CompletableFutureTask.run (CompletableFutureTask.java:64)
    at com.hazelcast.internal.util.executor.CachedExecutorServiceDelegate$Worker.run (CachedExecutorServiceDelegate.java:217)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1128)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:628)
    at java.lang.Thread.run (Thread.java:834)
    at com.hazelcast.internal.util.executor.HazelcastManagedThread.executeRun (HazelcastManagedThread.java:64)
    at com.hazelcast.internal.util.executor.HazelcastManagedThread.run (HazelcastManagedThread.java:80)
Caused by: java.lang.RuntimeException: Unknown type.  Value = 0x73726576
    at deepboof.io.torch7.TorchType.valueToType (TorchType.java:54)
    at deepboof.io.torch7.ParseBinaryTorch7.readType (ParseBinaryTorch7.java:59)
    at deepboof.io.torch7.ParseTorch7.parseNext (ParseTorch7.java:79)
    at deepboof.io.torch7.ParseTorch7.parse (ParseTorch7.java:68)
    at deepboof.io.torch7.ParseTorch7.parseOne (ParseTorch7.java:44)
    at deepboof.io.torch7.ParseTorch7.parseIntoBoof (ParseTorch7.java:51)
    at boofcv.deepboof.ImageClassifierVggCifar10.loadModel (ImageClassifierVggCifar10.java:77)
    at RealTimeImageRecognition.lambda$classifierContext$c72ad9b1$1 (RealTimeImageRecognition.java:200)
    at com.hazelcast.function.FunctionEx.apply (FunctionEx.java:47)
    at com.hazelcast.jet.impl.processor.ProcessorSupplierWithService.init (ProcessorSupplierWithService.java:55)
    at com.hazelcast.jet.impl.execution.init.ExecutionPlan.initProcSuppliers (ExecutionPlan.java:314)
    at com.hazelcast.jet.impl.execution.init.ExecutionPlan.initialize (ExecutionPlan.java:150)
    at com.hazelcast.jet.impl.execution.ExecutionContext.initialize (ExecutionContext.java:138)
    at com.hazelcast.jet.impl.JobExecutionService.lambda$initExecution$808bb183$1 (JobExecutionService.java:240)
    at com.hazelcast.jet.function.RunnableEx.run (RunnableEx.java:30)
    at com.hazelcast.jet.impl.util.Util.doWithClassLoader (Util.java:439)
    at com.hazelcast.jet.impl.JobExecutionService.initExecution (JobExecutionService.java:240)
    at com.hazelcast.jet.impl.operation.InitExecutionOperation.run (InitExecutionOperation.java:73)
    at com.hazelcast.spi.impl.operationservice.Operation.call (Operation.java:184)
    at com.hazelcast.spi.impl.operationservice.impl.OperationRunnerImpl.call (OperationRunnerImpl.java:228)
    at com.hazelcast.spi.impl.operationservice.impl.OperationRunnerImpl.run (OperationRunnerImpl.java:217)
    at com.hazelcast.spi.impl.operationexecutor.impl.OperationExecutorImpl.run (OperationExecutorImpl.java:406)
    at com.hazelcast.spi.impl.operationexecutor.impl.OperationExecutorImpl.runOrExecute (OperationExecutorImpl.java:433)
    at com.hazelcast.spi.impl.operationservice.impl.Invocation.doInvokeLocal (Invocation.java:590)
    at com.hazelcast.spi.impl.operationservice.impl.Invocation.doInvoke (Invocation.java:575)
    at com.hazelcast.spi.impl.operationservice.impl.Invocation.invoke0 (Invocation.java:534)
    at com.hazelcast.spi.impl.operationservice.impl.Invocation.invoke (Invocation.java:236)
    at com.hazelcast.spi.impl.operationservice.impl.InvocationBuilderImpl.invoke (InvocationBuilderImpl.java:59)
    at com.hazelcast.jet.impl.MasterContext.invokeOnParticipant (MasterContext.java:261)
    at com.hazelcast.jet.impl.MasterContext.invokeOnParticipants (MasterContext.java:245)
    at com.hazelcast.jet.impl.MasterJobContext.lambda$tryStartJob$2 (MasterJobContext.java:228)
    at com.hazelcast.jet.impl.JobCoordinationService.lambda$submitToCoordinatorThread$42 (JobCoordinationService.java:978)
    at com.hazelcast.jet.impl.JobCoordinationService.submitToCoordinatorThread (JobCoordinationService.java:987)
    at com.hazelcast.jet.impl.JobCoordinationService.submitToCoordinatorThread (JobCoordinationService.java:977)
    at com.hazelcast.jet.impl.MasterJobContext.tryStartJob (MasterJobContext.java:187)
    at com.hazelcast.jet.impl.JobCoordinationService.tryStartJob (JobCoordinationService.java:887)
    at com.hazelcast.jet.impl.JobCoordinationService.lambda$submitJob$1 (JobCoordinationService.java:246)
    at com.hazelcast.jet.impl.JobCoordinationService.lambda$submitToCoordinatorThread$42 (JobCoordinationService.java:978)
    at com.hazelcast.jet.impl.JobCoordinationService.lambda$submitToCoordinatorThread$43 (JobCoordinationService.java:997)
    at com.hazelcast.internal.util.executor.CompletableFutureTask.run (CompletableFutureTask.java:64)
    at com.hazelcast.internal.util.executor.CachedExecutorServiceDelegate$Worker.run (CachedExecutorServiceDelegate.java:217)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1128)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:628)
    at java.lang.Thread.run (Thread.java:834)
    at com.hazelcast.internal.util.executor.HazelcastManagedThread.executeRun (HazelcastManagedThread.java:64)
    at com.hazelcast.internal.util.executor.HazelcastManagedThread.run (HazelcastManagedThread.java:80)

But see also #122, this demo may have no long term life

@neilstevenson
Copy link
Contributor Author

Tried with Jet 4.4, and

        <dependency>
            <groupId>org.boofcv</groupId>
            <artifactId>boofcv-core</artifactId>
            <version>0.37</version>
        </dependency>
        <dependency>
            <groupId>org.boofcv</groupId>
            <artifactId>boofcv-WebcamCapture</artifactId>
            <version>0.37</version>
        </dependency>

Still broken, same error

Caused by: java.lang.RuntimeException: Unknown type.  Value = 0x73726576
    at deepboof.io.torch7.TorchType.valueToType (TorchType.java:54)
    at deepboof.io.torch7.ParseBinaryTorch7.readType (ParseBinaryTorch7.java:59)
    at deepboof.io.torch7.ParseTorch7.parseNext (ParseTorch7.java:79)
    at deepboof.io.torch7.ParseTorch7.parse (ParseTorch7.java:68)
    at deepboof.io.torch7.ParseTorch7.parseOne (ParseTorch7.java:44)
    at deepboof.io.torch7.ParseTorch7.parseIntoBoof (ParseTorch7.java:51)
    at boofcv.deepboof.ImageClassifierVggCifar10.loadModel (ImageClassifierVggCifar10.java:75)
    at RealTimeImageRecognition.lambda$classifierContext$c72ad9b1$1 (RealTimeImageRecognition.java:200)
    at com.hazelcast.function.FunctionEx.apply (FunctionEx.java:47)
    at com.hazelcast.jet.impl.processor.ProcessorSupplierWithService.init (ProcessorSupplierWithService.java:55)
    at com.hazelcast.jet.impl.execution.init.ExecutionPlan.initProcSuppliers (ExecutionPlan.java:319)
    at com.hazelcast.jet.impl.execution.init.ExecutionPlan.initialize (ExecutionPlan.java:165)
    at com.hazelcast.jet.impl.execution.ExecutionContext.initialize (ExecutionContext.java:138)
    at com.hazelcast.jet.impl.JobExecutionService.lambda$initExecution$544ea571$1 (JobExecutionService.java:241)
    at com.hazelcast.jet.function.RunnableEx.run (RunnableEx.java:30)
    at com.hazelcast.jet.impl.util.Util.doWithClassLoader (Util.java:467)
    at com.hazelcast.jet.impl.JobExecutionService.initExecution (JobExecutionService.java:241)
    at com.hazelcast.jet.impl.operation.InitExecutionOperation.run (InitExecutionOperation.java:73)
    at com.hazelcast.spi.impl.operationservice.Operation.call (Operation.java:184)
    at com.hazelcast.spi.impl.operationservice.impl.OperationRunnerImpl.call (OperationRunnerImpl.java:256)
    at com.hazelcast.spi.impl.operationservice.impl.OperationRunnerImpl.run (OperationRunnerImpl.java:237)
    at com.hazelcast.spi.impl.operationservice.impl.OperationRunnerImpl.run (OperationRunnerImpl.java:213)
    at com.hazelcast.spi.impl.operationexecutor.impl.OperationExecutorImpl.run (OperationExecutorImpl.java:411)
    at com.hazelcast.spi.impl.operationexecutor.impl.OperationExecutorImpl.runOrExecute (OperationExecutorImpl.java:438)
    at com.hazelcast.spi.impl.operationservice.impl.Invocation.doInvokeLocal (Invocation.java:603)
    at com.hazelcast.spi.impl.operationservice.impl.Invocation.doInvoke (Invocation.java:588)
    at com.hazelcast.spi.impl.operationservice.impl.Invocation.invoke0 (Invocation.java:547)
    at com.hazelcast.spi.impl.operationservice.impl.Invocation.invoke (Invocation.java:244)
    at com.hazelcast.spi.impl.operationservice.impl.InvocationBuilderImpl.invoke (InvocationBuilderImpl.java:59)
    at com.hazelcast.jet.impl.MasterContext.invokeOnParticipant (MasterContext.java:264)
    at com.hazelcast.jet.impl.MasterContext.invokeOnParticipants (MasterContext.java:247)
    at com.hazelcast.jet.impl.MasterJobContext.lambda$tryStartJob$2 (MasterJobContext.java:228)
    at com.hazelcast.jet.impl.JobCoordinationService.lambda$submitToCoordinatorThread$46 (JobCoordinationService.java:1039)
    at com.hazelcast.jet.impl.JobCoordinationService.submitToCoordinatorThread (JobCoordinationService.java:1048)
    at com.hazelcast.jet.impl.JobCoordinationService.submitToCoordinatorThread (JobCoordinationService.java:1038)
    at com.hazelcast.jet.impl.MasterJobContext.tryStartJob (MasterJobContext.java:190)
    at com.hazelcast.jet.impl.JobCoordinationService.tryStartJob (JobCoordinationService.java:948)
    at com.hazelcast.jet.impl.JobCoordinationService.lambda$submitJob$1 (JobCoordinationService.java:267)
    at com.hazelcast.jet.impl.JobCoordinationService.lambda$submitToCoordinatorThread$46 (JobCoordinationService.java:1039)
    at com.hazelcast.jet.impl.JobCoordinationService.lambda$submitToCoordinatorThread$47 (JobCoordinationService.java:1060)
    at com.hazelcast.internal.util.executor.CompletableFutureTask.run (CompletableFutureTask.java:64)
    at com.hazelcast.internal.util.executor.CachedExecutorServiceDelegate$Worker.run (CachedExecutorServiceDelegate.java:217)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1130)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:630)
    at java.lang.Thread.run (Thread.java:832)
    at com.hazelcast.internal.util.executor.HazelcastManagedThread.executeRun (HazelcastManagedThread.java:76)
    at com.hazelcast.internal.util.executor.HazelcastManagedThread.run (HazelcastManagedThread.java:102)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant