OpenMined / KotlinSyft

The official Syft worker for secure on-device machine learning
https://www.openmined.org
Apache License 2.0
86 stars 27 forks source link

java.lang.IllegalStateException: Cannot re-initialize NativeLoader #324

Open mustansarsaeed opened 3 years ago

mustansarsaeed commented 3 years ago

Hi,

Training on mobile devices work fine but after certain rounds or sometimes on first round, I get the following exception:

java.lang.IllegalStateException: Cannot re-initialize NativeLoader.
org.openmined.syft.demo W/System.err:     at com.facebook.soloader.nativeloader.NativeLoader.init(NativeLoader.java:54)
org.openmined.syft.demo W/System.err:     at org.pytorch.Module.load(Module.java:21)
org.openmined.syft.demo W/System.err:     at org.openmined.syft.execution.Plan.loadScriptModule(Plan.kt:50)
org.openmined.syft.demo W/System.err:     at org.openmined.syft.domain.JobRepository$processPlans$2$1.subscribe(JobRepository.kt:181)
org.openmined.syft.demo W/System.err:     at io.reactivex.internal.operators.single.SingleCreate.subscribeActual(SingleCreate.java:39)
org.openmined.syft.demo W/System.err:     at io.reactivex.Single.subscribe(Single.java:3603)
org.openmined.syft.demo W/System.err:     at io.reactivex.internal.operators.single.SingleFlatMap$SingleFlatMapCallback.onSuccess(SingleFlatMap.java:84)
org.openmined.syft.demo W/System.err:     at io.reactivex.internal.operators.single.SingleFlatMap$SingleFlatMapCallback$FlatMapSingleObserver.onSuccess(SingleFlatMap.java:111)
org.openmined.syft.demo W/System.err:     at io.reactivex.internal.operators.single.SingleCreate$Emitter.onSuccess(SingleCreate.java:67)
org.openmined.syft.demo W/System.err:     at org.openmined.syft.datasource.JobLocalDataSource$saveAsync$$inlined$apply$lambda$1.subscribe(JobLocalDataSource.kt:85)
org.openmined.syft.demo W/System.err:     at io.reactivex.internal.operators.single.SingleCreate.subscribeActual(SingleCreate.java:39)
org.openmined.syft.demo W/System.err:     at io.reactivex.Single.subscribe(Single.java:3603)
org.openmined.syft.demo W/System.err:     at io.reactivex.internal.operators.single.SingleFlatMap$SingleFlatMapCallback.onSuccess(SingleFlatMap.java:84)
org.openmined.syft.demo W/System.err:     at io.reactivex.internal.operators.single.SingleMap$MapSingleObserver.onSuccess(SingleMap.java:64)
org.openmined.syft.demo W/System.err:     at io.reactivex.internal.operators.observable.ObservableSingleSingle$SingleElementObserver.onComplete(ObservableSingleSingle.java:109)
org.openmined.syft.demo W/System.err:     at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:51)
org.openmined.syft.demo W/System.err:     at io.reactivex.Observable.subscribe(Observable.java:12267)
org.openmined.syft.demo W/System.err:     at io.reactivex.internal.operators.observable.ObservableSingleSingle.subscribeActual(ObservableSingleSingle.java:35)
org.openmined.syft.demo W/System.err:     at io.reactivex.Single.subscribe(Single.java:3603)
org.openmined.syft.demo W/System.err:     at io.reactivex.internal.operators.single.SingleMap.subscribeActual(SingleMap.java:34)
org.openmined.syft.demo W/System.err:     at io.reactivex.Single.subscribe(Single.java:3603)
org.openmined.syft.demo W/System.err:     at io.reactivex.internal.operators.single.SingleFlatMap.subscribeActual(SingleFlatMap.java:36)
org.openmined.syft.demo W/System.err:     at io.reactivex.Single.subscribe(Single.java:3603)
org.openmined.syft.demo W/System.err:     at io.reactivex.internal.operators.single.SingleFlatMap.subscribeActual(SingleFlatMap.java:36)
org.openmined.syft.demo W/System.err:     at io.reactivex.Single.subscribe(Single.java:3603)
org.openmined.syft.demo W/System.err:     at io.reactivex.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.run(SingleSubscribeOn.java:89)
org.openmined.syft.demo W/System.err:     at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:578)
org.openmined.syft.demo W/System.err:     at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
org.openmined.syft.demo W/System.err:     at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
org.openmined.syft.demo W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
org.openmined.syft.demo W/System.err:     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
org.openmined.syft.demo W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
org.openmined.syft.demo W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
org.openmined.syft.demo W/System.err:     at java.lang.Thread.run(Thread.java:764)
org.openmined.syft.demo E/Syft: Cannot re-initialize NativeLoader.

Can anyone please comment how to stop this re-initialization? I have tried to put null-checks to stop this but get another error on executing the Plans.