frostwire / frostwire-jlibtorrent

A swig Java interface for libtorrent by the makers of FrostWire. Develop libtorrent based apps with the joy of coding in Java.
http://www.frostwire.com
MIT License
444 stars 137 forks source link

[Android/NETLINK_ROUTE Issue] Torrent download not working on Poco F1, Realme RMX1921 (Android 11) and probably other devices too #254

Closed vickyoo7 closed 2 years ago

vickyoo7 commented 3 years ago

I'm using version 1.2.11.0 (targetSdk 29) and Torrent download is not working on some (Poco F1, Realme RMX1921) Android 11 devices possibly due to below error.

E mac-restrictions: com.package.name:DownloadService tried to call bind() on a NETLINK_ROUTE socket, which is not allowed. Please follow instructions at go/netlink-bug if this app behaves incorrectly.

Related SO post - https://stackoverflow.com/questions/64884994/cannot-bind-netlink-socket-when-targeting-android-api-30

Note: version 1.2.10.0 with targetSdk 28 works fine

gubatron commented 3 years ago

com.package.name:DownloadService tried to call bind() on a NETLINK_ROUTE socket

It'd be great if you could share the code of your DownloadService class to see what jlibtorrent function is triggering this. Or perhaps a stacktrace.

vickyoo7 commented 3 years ago

com.package.name:DownloadService tried to call bind() on a NETLINK_ROUTE socket

It'd be great if you could share the code of your DownloadService class to see what jlibtorrent function is triggering this. Or perhaps a stacktrace.

Code

@WorkerThread private void initTorrentEngine() { try { if ((mTorrentEngine == null || mTorrentEngine.isStoppedReal()) && Utility.isTorrentSupport()) { mTorrentEngine = TorrentEngine2.getInstance(); mTorrentEngine.setContext(getApplicationContext()); mTorrentEngine.setCallback(this); mTorrentEngine.start(5000); } } catch (Throwable t) { t.printStackTrace(); } }

Stacktrace

02-24 16:24:29.523 D/Zygote (664): Forked child process 1901 02-24 16:24:29.526 I/ActivityManager(1456): Start proc 1901:idm.internet.download.manager.plus:DownloadService/u0a195 for service {idm.internet.download.manager.plus/idm.internet.download.manager.DownloadService} 02-24 16:24:29.549 E/DownloadServic(1901): Not starting debugger since process cannot load the jdwp agent. 02-24 16:24:29.568 W/DownloadServic(1901): Core platform API violation: Ljava/lang/reflect/Field;->accessFlags:I from Landroid/os/Build; using reflection 02-24 16:24:29.569 D/OpenGLRenderer(29648): endAllActiveAnimators on 0x77e7354910 (RippleDrawable) with handle 0x770710c7f0 02-24 16:24:29.583 D/CompatibilityInfo(1456): mCompatibilityFlags - 0 02-24 16:24:29.583 D/CompatibilityInfo(1456): applicationDensity - 371 02-24 16:24:29.583 D/CompatibilityInfo(1456): applicationScale - 1.0 02-24 16:24:29.587 D/CompatibilityInfo(1456): mCompatibilityFlags - 0 02-24 16:24:29.587 D/CompatibilityInfo(1456): applicationDensity - 371 02-24 16:24:29.587 D/CompatibilityInfo(1456): applicationScale - 1.0 02-24 16:24:29.598 D/ApplicationLoaders(1901): Returning zygote-cached class loader: /system/framework/android.test.base.jar 02-24 16:24:29.601 I/DownloadServic(1901): The ClassLoaderContext is a special shared library. 02-24 16:24:29.615 W/DownloadServic(1901): JIT profile information will not be recorded: profile file does not exist. 02-24 16:24:29.615 W/DownloadServic(1901): JIT profile information will not be recorded: profile file does not exist. 02-24 16:24:29.626 I/Perf (1901): Connecting to perf service. 02-24 16:24:29.627 I/GoogleInputMethodService(4221): GoogleInputMethodService.onFinishInput():3341 02-24 16:24:29.627 I/GoogleInputMethodService(4221): GoogleInputMethodService.onStartInput():1906 02-24 16:24:29.632 D/NetworkSecurityConfig(1901): Using Network Security Config from resource network_security_config debugBuild: false 02-24 16:24:29.738 D/CompatibilityChangeReporter(1456): Compat change id reported: 136274596; UID 10195; state: DISABLED 02-24 16:24:29.633 D/NetworkSecurityConfig(1901): Using Network Security Config from resource network_security_config debugBuild: false 02-24 16:24:29.771 D/mobile-ffmpeg(1901): Callback thread started. 02-24 16:24:29.772 D/mobile-ffmpeg(1901): Callback thread stopped. 02-24 16:24:29.776 I/TetheringManager(1901): registerTetheringEventCallback:idm.internet.download.manager.plus 02-24 16:24:29.783 W/UriGrantsManagerService(1456): No permission grants found for idm.internet.download.manager.plus 02-24 16:24:29.790 I/WifiService(1456): acquireWifiLock uid=10195 lockMode=3 02-24 16:24:29.844 E/mac-restrictions(1901): idm.internet.download.manager.plus:DownloadService tried to call bind() on a NETLINK_ROUTE socket, which is not allowed. Please follow instructions at go/netlink-bug if this app behaves incorrectly. 02-24 16:24:30.008 E/IorapForwardingService(1456): No service published for: iorapd 02-24 16:24:30.008 E/IorapForwardingService(1456): android.os.ServiceManager$ServiceNotFoundException: No service published for: iorapd 02-24 16:24:30.008 E/IorapForwardingService(1456): at android.os.ServiceManager.getServiceOrThrow(ServiceManager.java:153) 02-24 16:24:30.008 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.provideIorapRemote(IorapForwardingService.java:125) 02-24 16:24:30.008 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.connectToRemoteAndConfigureLocked(IorapForwardingService.java:297) 02-24 16:24:30.008 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.connectToRemoteAndConfigure(IorapForwardingService.java:279) 02-24 16:24:30.008 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.retryConnectToRemoteAndConfigure(IorapForwardingService.java:251) 02-24 16:24:30.008 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.access$000(IorapForwardingService.java:59) 02-24 16:24:30.008 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService$BinderConnectionHandler.handleMessage(IorapForwardingService.java:223) 02-24 16:24:30.008 E/IorapForwardingService(1456): at android.os.Handler.dispatchMessage(Handler.java:106) 02-24 16:24:30.008 E/IorapForwardingService(1456): at android.os.Looper.loop(Looper.java:223) 02-24 16:24:30.008 E/IorapForwardingService(1456): at android.os.HandlerThread.run(HandlerThread.java:67) 02-24 16:24:30.008 E/IorapForwardingService(1456): at com.android.server.ServiceThread.run(ServiceThread.java:44) 02-24 16:24:30.010 I/DropBoxManagerService(1456): add tag=system_server_wtf isTagEnabled=true flags=0x2 02-24 16:24:31.015 I/DropBoxManagerService(1456): add tag=system_server_wtf isTagEnabled=true flags=0x2 02-24 16:24:31.023 W/BroadcastQueue(1456): Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.stats.service.DropBoxEntryAddedReceiver 02-24 16:24:31.024 W/BroadcastQueue(1456): Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver 02-24 16:24:31.012 E/IorapForwardingService(1456): No service published for: iorapd 02-24 16:24:31.012 E/IorapForwardingService(1456): android.os.ServiceManager$ServiceNotFoundException: No service published for: iorapd 02-24 16:24:31.012 E/IorapForwardingService(1456): at android.os.ServiceManager.getServiceOrThrow(ServiceManager.java:153) 02-24 16:24:31.012 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.provideIorapRemote(IorapForwardingService.java:125) 02-24 16:24:31.012 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.connectToRemoteAndConfigureLocked(IorapForwardingService.java:297) 02-24 16:24:31.012 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.connectToRemoteAndConfigure(IorapForwardingService.java:279) 02-24 16:24:31.012 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.retryConnectToRemoteAndConfigure(IorapForwardingService.java:251) 02-24 16:24:31.012 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.access$000(IorapForwardingService.java:59) 02-24 16:24:31.012 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService$BinderConnectionHandler.handleMessage(IorapForwardingService.java:223) 02-24 16:24:31.012 E/IorapForwardingService(1456): at android.os.Handler.dispatchMessage(Handler.java:106) 02-24 16:24:31.012 E/IorapForwardingService(1456): at android.os.Looper.loop(Looper.java:223) 02-24 16:24:31.012 E/IorapForwardingService(1456): at android.os.HandlerThread.run(HandlerThread.java:67) 02-24 16:24:31.012 E/IorapForwardingService(1456): at com.android.server.ServiceThread.run(ServiceThread.java:44) 02-24 16:24:31.047 D/CompatibilityInfo(1456): mCompatibilityFlags - 0 02-24 16:24:31.047 D/CompatibilityInfo(1456): applicationDensity - 371 02-24 16:24:31.047 D/CompatibilityInfo(1456): applicationScale - 1.0 02-24 16:24:32.017 E/IorapForwardingService(1456): No service published for: iorapd 02-24 16:24:32.017 E/IorapForwardingService(1456): android.os.ServiceManager$ServiceNotFoundException: No service published for: iorapd 02-24 16:24:32.017 E/IorapForwardingService(1456): at android.os.ServiceManager.getServiceOrThrow(ServiceManager.java:153) 02-24 16:24:32.017 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.provideIorapRemote(IorapForwardingService.java:125) 02-24 16:24:32.017 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.connectToRemoteAndConfigureLocked(IorapForwardingService.java:297) 02-24 16:24:32.017 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.connectToRemoteAndConfigure(IorapForwardingService.java:279) 02-24 16:24:32.017 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.retryConnectToRemoteAndConfigure(IorapForwardingService.java:251) 02-24 16:24:32.017 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.access$000(IorapForwardingService.java:59) 02-24 16:24:32.017 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService$BinderConnectionHandler.handleMessage(IorapForwardingService.java:223) 02-24 16:24:32.017 E/IorapForwardingService(1456): at android.os.Handler.dispatchMessage(Handler.java:106) 02-24 16:24:32.017 E/IorapForwardingService(1456): at android.os.Looper.loop(Looper.java:223) 02-24 16:24:32.017 E/IorapForwardingService(1456): at android.os.HandlerThread.run(HandlerThread.java:67) 02-24 16:24:32.017 E/IorapForwardingService(1456): at com.android.server.ServiceThread.run(ServiceThread.java:44) 02-24 16:24:32.020 I/DropBoxManagerService(1456): add tag=system_server_wtf isTagEnabled=true flags=0x2 02-24 16:24:32.371 I/SessionManager(29648): Error fetching magnet 02-24 16:24:32.371 I/SessionManager(29648): java.lang.InterruptedException 02-24 16:24:32.371 I/SessionManager(29648): at java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1356) 02-24 16:24:32.371 I/SessionManager(29648): at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:278) 02-24 16:24:32.371 I/SessionManager(29648): at com.frostwire.jlibtorrent.SessionManager.fetchMagnet(Unknown Source:228) 02-24 16:24:32.371 I/SessionManager(29648): at i.od0.ۦۖ۫(Unknown Source:18) 02-24 16:24:32.371 I/SessionManager(29648): at i.zc0.ۦۖ۫(Unknown Source:681) 02-24 16:24:32.371 I/SessionManager(29648): at i.zc0.run(Unknown Source:0) 02-24 16:24:32.371 I/SessionManager(29648): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 02-24 16:24:32.371 I/SessionManager(29648): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 02-24 16:24:32.371 I/SessionManager(29648): at java.lang.Thread.run(Thread.java:923) 02-24 16:24:33.021 E/IorapForwardingService(1456): No service published for: iorapd 02-24 16:24:33.021 E/IorapForwardingService(1456): android.os.ServiceManager$ServiceNotFoundException: No service published for: iorapd 02-24 16:24:33.021 E/IorapForwardingService(1456): at android.os.ServiceManager.getServiceOrThrow(ServiceManager.java:153) 02-24 16:24:33.021 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.provideIorapRemote(IorapForwardingService.java:125) 02-24 16:24:33.021 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.connectToRemoteAndConfigureLocked(IorapForwardingService.java:297) 02-24 16:24:33.021 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.connectToRemoteAndConfigure(IorapForwardingService.java:279) 02-24 16:24:33.021 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.retryConnectToRemoteAndConfigure(IorapForwardingService.java:251) 02-24 16:24:33.021 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.access$000(IorapForwardingService.java:59) 02-24 16:24:33.021 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService$BinderConnectionHandler.handleMessage(IorapForwardingService.java:223) 02-24 16:24:33.021 E/IorapForwardingService(1456): at android.os.Handler.dispatchMessage(Handler.java:106) 02-24 16:24:33.021 E/IorapForwardingService(1456): at android.os.Looper.loop(Looper.java:223) 02-24 16:24:33.021 E/IorapForwardingService(1456): at android.os.HandlerThread.run(HandlerThread.java:67) 02-24 16:24:33.021 E/IorapForwardingService(1456): at com.android.server.ServiceThread.run(ServiceThread.java:44) 02-24 16:24:33.025 I/DropBoxManagerService(1456): add tag=system_server_wtf isTagEnabled=true flags=0x2 02-24 16:24:33.033 W/BroadcastQueue(1456): Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.stats.service.DropBoxEntryAddedReceiver 02-24 16:24:33.033 W/BroadcastQueue(1456): Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver 02-24 16:24:33.055 D/CompatibilityInfo(1456): mCompatibilityFlags - 0 02-24 16:24:33.055 D/CompatibilityInfo(1456): applicationDensity - 371 02-24 16:24:33.055 D/CompatibilityInfo(1456): applicationScale - 1.0 02-24 16:24:34.025 E/IorapForwardingService(1456): No service published for: iorapd 02-24 16:24:34.025 E/IorapForwardingService(1456): android.os.ServiceManager$ServiceNotFoundException: No service published for: iorapd 02-24 16:24:34.025 E/IorapForwardingService(1456): at android.os.ServiceManager.getServiceOrThrow(ServiceManager.java:153) 02-24 16:24:34.025 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.provideIorapRemote(IorapForwardingService.java:125) 02-24 16:24:34.025 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.connectToRemoteAndConfigureLocked(IorapForwardingService.java:297) 02-24 16:24:34.025 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.connectToRemoteAndConfigure(IorapForwardingService.java:279) 02-24 16:24:34.025 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.retryConnectToRemoteAndConfigure(IorapForwardingService.java:251) 02-24 16:24:34.025 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.access$000(IorapForwardingService.java:59) 02-24 16:24:34.025 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService$BinderConnectionHandler.handleMessage(IorapForwardingService.java:223) 02-24 16:24:34.025 E/IorapForwardingService(1456): at android.os.Handler.dispatchMessage(Handler.java:106) 02-24 16:24:34.025 E/IorapForwardingService(1456): at android.os.Looper.loop(Looper.java:223) 02-24 16:24:34.025 E/IorapForwardingService(1456): at android.os.HandlerThread.run(HandlerThread.java:67) 02-24 16:24:34.025 E/IorapForwardingService(1456): at com.android.server.ServiceThread.run(ServiceThread.java:44) 02-24 16:24:34.907 D/CompatibilityChangeReporter(1456): Compat change id reported: 136219221; UID 10195; state: DISABLED 02-24 16:24:34.925 E/mac-restrictions(1901): idm.internet.download.manager.plus:DownloadService tried to call bind() on a NETLINK_ROUTE socket, which is not allowed. Please follow instructions at go/netlink-bug if this app behaves incorrectly. 02-24 16:24:35.030 E/IorapForwardingService(1456): No service published for: iorapd 02-24 16:24:35.030 E/IorapForwardingService(1456): android.os.ServiceManager$ServiceNotFoundException: No service published for: iorapd 02-24 16:24:35.030 E/IorapForwardingService(1456): at android.os.ServiceManager.getServiceOrThrow(ServiceManager.java:153) 02-24 16:24:35.030 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.provideIorapRemote(IorapForwardingService.java:125) 02-24 16:24:35.030 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.connectToRemoteAndConfigureLocked(IorapForwardingService.java:297) 02-24 16:24:35.030 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.connectToRemoteAndConfigure(IorapForwardingService.java:279) 02-24 16:24:35.030 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.retryConnectToRemoteAndConfigure(IorapForwardingService.java:251) 02-24 16:24:35.030 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.access$000(IorapForwardingService.java:59) 02-24 16:24:35.030 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService$BinderConnectionHandler.handleMessage(IorapForwardingService.java:223) 02-24 16:24:35.030 E/IorapForwardingService(1456): at android.os.Handler.dispatchMessage(Handler.java:106) 02-24 16:24:35.030 E/IorapForwardingService(1456): at android.os.Looper.loop(Looper.java:223) 02-24 16:24:35.030 E/IorapForwardingService(1456): at android.os.HandlerThread.run(HandlerThread.java:67) 02-24 16:24:35.030 E/IorapForwardingService(1456): at com.android.server.ServiceThread.run(ServiceThread.java:44) 02-24 16:24:35.037 W/BroadcastQueue(1456): Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.stats.service.DropBoxEntryAddedReceiver 02-24 16:24:35.038 W/BroadcastQueue(1456): Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver 02-24 16:24:35.063 D/CompatibilityInfo(1456): mCompatibilityFlags - 0 02-24 16:24:35.063 D/CompatibilityInfo(1456): applicationDensity - 371 02-24 16:24:35.063 D/CompatibilityInfo(1456): applicationScale - 1.0 02-24 16:24:35.115 D/NotificationService(1456): 0|idm.internet.download.manager.plus|1|null|10195: granting content://settings/system/notification_sound 02-24 16:24:35.117 V/chatty (1456): uid=1000 system_server identical 6 lines 02-24 16:24:35.117 D/NotificationService(1456): 0|idm.internet.download.manager.plus|1|null|10195: granting content://settings/system/notification_sound 02-24 16:24:35.120 W/NotificationHistory(1456): Attempted to add notif for locked/gone/disabled user 0 02-24 16:24:35.137 D/InterruptionStateProvider(2301): No bubble up: not allowed to bubble: 0|idm.internet.download.manager.plus|1|null|10195 02-24 16:24:35.138 D/InterruptionStateProvider(2301): No heads up: unimportant notification: 0|idm.internet.download.manager.plus|1|null|10195 02-24 16:24:36.035 E/IorapForwardingService(1456): No service published for: iorapd 02-24 16:24:36.035 E/IorapForwardingService(1456): android.os.ServiceManager$ServiceNotFoundException: No service published for: iorapd 02-24 16:24:36.035 E/IorapForwardingService(1456): at android.os.ServiceManager.getServiceOrThrow(ServiceManager.java:153) 02-24 16:24:36.035 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.provideIorapRemote(IorapForwardingService.java:125) 02-24 16:24:36.035 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.connectToRemoteAndConfigureLocked(IorapForwardingService.java:297) 02-24 16:24:36.035 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.connectToRemoteAndConfigure(IorapForwardingService.java:279) 02-24 16:24:36.035 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.retryConnectToRemoteAndConfigure(IorapForwardingService.java:251) 02-24 16:24:36.035 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.access$000(IorapForwardingService.java:59) 02-24 16:24:36.035 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService$BinderConnectionHandler.handleMessage(IorapForwardingService.java:223) 02-24 16:24:36.035 E/IorapForwardingService(1456): at android.os.Handler.dispatchMessage(Handler.java:106) 02-24 16:24:36.035 E/IorapForwardingService(1456): at android.os.Looper.loop(Looper.java:223) 02-24 16:24:36.035 E/IorapForwardingService(1456): at android.os.HandlerThread.run(HandlerThread.java:67) 02-24 16:24:36.035 E/IorapForwardingService(1456): at com.android.server.ServiceThread.run(ServiceThread.java:44) 02-24 16:24:36.068 D/InterruptionStateProvider(2301): No bubble up: not allowed to bubble: 0|idm.internet.download.manager.plus|1|null|10195 02-24 16:24:36.069 D/InterruptionStateProvider(2301): No heads up: unimportant notification: 0|idm.internet.download.manager.plus|1|null|10195 02-24 16:24:36.479 D/CompatibilityInfo(1456): mCompatibilityFlags - 0 02-24 16:24:36.479 D/CompatibilityInfo(1456): applicationDensity - 371 02-24 16:24:36.479 D/CompatibilityInfo(1456): applicationScale - 1.0 02-24 16:24:36.490 D/CompatibilityInfo(1456): mCompatibilityFlags - 0 02-24 16:24:36.490 D/CompatibilityInfo(1456): applicationDensity - 371 02-24 16:24:36.490 D/CompatibilityInfo(1456): applicationScale - 1.0 02-24 16:24:36.620 D/InterruptionStateProvider(2301): No bubble up: not allowed to bubble: 0|idm.internet.download.manager.plus|1|null|10195 02-24 16:24:36.621 D/InterruptionStateProvider(2301): No heads up: unimportant notification: 0|idm.internet.download.manager.plus|1|null|10195 02-24 16:24:37.041 E/IorapForwardingService(1456): No service published for: iorapd 02-24 16:24:37.041 E/IorapForwardingService(1456): android.os.ServiceManager$ServiceNotFoundException: No service published for: iorapd 02-24 16:24:37.041 E/IorapForwardingService(1456): at android.os.ServiceManager.getServiceOrThrow(ServiceManager.java:153) 02-24 16:24:37.041 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.provideIorapRemote(IorapForwardingService.java:125) 02-24 16:24:37.041 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.connectToRemoteAndConfigureLocked(IorapForwardingService.java:297) 02-24 16:24:37.041 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.connectToRemoteAndConfigure(IorapForwardingService.java:279) 02-24 16:24:37.041 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.retryConnectToRemoteAndConfigure(IorapForwardingService.java:251) 02-24 16:24:37.041 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.access$000(IorapForwardingService.java:59) 02-24 16:24:37.041 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService$BinderConnectionHandler.handleMessage(IorapForwardingService.java:223) 02-24 16:24:37.041 E/IorapForwardingService(1456): at android.os.Handler.dispatchMessage(Handler.java:106) 02-24 16:24:37.041 E/IorapForwardingService(1456): at android.os.Looper.loop(Looper.java:223) 02-24 16:24:37.041 E/IorapForwardingService(1456): at android.os.HandlerThread.run(HandlerThread.java:67) 02-24 16:24:37.041 E/IorapForwardingService(1456): at com.android.server.ServiceThread.run(ServiceThread.java:44) 02-24 16:24:37.170 D/InterruptionStateProvider(2301): No bubble up: not allowed to bubble: 0|idm.internet.download.manager.plus|1|null|10195 02-24 16:24:37.172 D/InterruptionStateProvider(2301): No heads up: unimportant notification: 0|idm.internet.download.manager.plus|1|null|10195 02-24 16:24:37.731 D/InterruptionStateProvider(2301): No bubble up: not allowed to bubble: 0|idm.internet.download.manager.plus|1|null|10195 02-24 16:24:37.732 D/InterruptionStateProvider(2301): No heads up: unimportant notification: 0|idm.internet.download.manager.plus|1|null|10195 02-24 16:24:38.045 E/IorapForwardingService(1456): No service published for: iorapd 02-24 16:24:38.045 E/IorapForwardingService(1456): android.os.ServiceManager$ServiceNotFoundException: No service published for: iorapd 02-24 16:24:38.045 E/IorapForwardingService(1456): at android.os.ServiceManager.getServiceOrThrow(ServiceManager.java:153) 02-24 16:24:38.045 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.provideIorapRemote(IorapForwardingService.java:125) 02-24 16:24:38.045 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.connectToRemoteAndConfigureLocked(IorapForwardingService.java:297) 02-24 16:24:38.045 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.connectToRemoteAndConfigure(IorapForwardingService.java:279) 02-24 16:24:38.045 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.retryConnectToRemoteAndConfigure(IorapForwardingService.java:251) 02-24 16:24:38.045 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService.access$000(IorapForwardingService.java:59) 02-24 16:24:38.045 E/IorapForwardingService(1456): at com.google.android.startop.iorap.IorapForwardingService$BinderConnectionHandler.handleMessage(IorapForwardingService.java:223) 02-24 16:24:38.045 E/IorapForwardingService(1456): at android.os.Handler.dispatchMessage(Handler.java:106) 02-24 16:24:38.045 E/IorapForwardingService(1456): at android.os.Looper.loop(Looper.java:223) 02-24 16:24:38.045 E/IorapForwardingService(1456): at android.os.HandlerThread.run(HandlerThread.java:67) 02-24 16:24:38.045 E/IorapForwardingService(1456): at com.android.server.ServiceThread.run(ServiceThread.java:44) 02-24 16:24:38.161 D/MobileLoggingSuite(3753): Executing Sushi UploadTask... 02-24 16:24:38.161 D/MobileLoggingSuite(3753): Starting upload of previously persisted events in path /data/user/0/in.amazon.mShop.android.shopping/files/mls/nexus/sushi_normal 02-24 16:24:38.161 D/MobileLoggingSuite(3753): Completed upload of previously persisted events in path /data/user/0/in.amazon.mShop.android.shopping/files/mls/nexus/sushi_normal 02-24 16:24:38.162 D/MobileLoggingSuite(3753): Sushi UploadTask completed successfully

gubatron commented 3 years ago

are these methods thread safe?

mTorrentEngine = TorrentEngine2.getInstance();
mTorrentEngine.setContext(getApplicationContext());
mTorrentEngine.setCallback(this);
mTorrentEngine.start(5000);
gubatron commented 3 years ago

I think this may have something to do with API 24, I think our next build might fix this

vickyoo7 commented 3 years ago

are these methods thread safe?

mTorrentEngine = TorrentEngine2.getInstance();
mTorrentEngine.setContext(getApplicationContext());
mTorrentEngine.setCallback(this);
mTorrentEngine.start(5000);

Yes they are thread safe

vickyoo7 commented 3 years ago

I think this may have something to do with API 24, I think our next build might fix this

Okay, I'll ask the user to test it out

neveroffline commented 3 years ago

API 30 fails with a bind permission error. API 29 <= on 1.2.10 is working.

(from an S21 Ultra on API 30 right after trying to load magnet) E/audit: type=1400 audit(1615648279.833:56933): avc: denied { bind } for pid=7431 comm="LIBTOR" scontext=u:r:untrusted_app:s0:c53,c257,c512,c768 tcontext=u:r:untrusted_app:s0:c53,c257,c512,c768 tclass=netlink_route_socket permissive=0 SEPF_SM-G998U1_11_0007 audit_filtered

vickyoo7 commented 3 years ago

I think this may have something to do with API 24, I think our next build might fix this

Unfortunately the user is still having the same issue with version 1.2.13.0

vickyoo7 commented 3 years ago

API 30 fails with a bind permission error. API 29 <= on 1.2.10 is working.

(from an S21 Ultra on API 30 right after trying to load magnet) E/audit: type=1400 audit(1615648279.833:56933): avc: denied { bind } for pid=7431 comm="LIBTOR" scontext=u:r:untrusted_app:s0:c53,c257,c512,c768 tcontext=u:r:untrusted_app:s0:c53,c257,c512,c768 tclass=netlink_route_socket permissive=0 SEPF_SM-G998U1_11_0007 audit_filtered

Did you test on a custom ROM?

vickyoo7 commented 3 years ago

Perhaps this might be helpful

https://github.com/lighthouse-os/bionic/commit/e5fda1bbb53b41e5bd0890de394b7f9ecc91932a

XiongKe94 commented 3 years ago

@gubatron I have had the same problem with the

xueqiya commented 3 years ago

@gubatron I have this problem too

gubatron commented 3 years ago

Apparently more restrictions after Android 11

https://developer.android.com/training/articles/user-data-ids#mac-11-plus Screen Shot 2021-06-04 at 9 27 53 AM

FunkyMuse commented 3 years ago

Apparently more restrictions after Android 11

https://developer.android.com/training/articles/user-data-ids#mac-11-plus Screen Shot 2021-06-04 at 9 27 53 AM

Any workaround for this?

gubatron commented 3 years ago

Investigating issue.

Here's a few references to NETLINK_ROUTE sockets on the libtorrent 1.2.x source code:

include/libtorrent/netlink.hpp:     netlink() : netlink(NETLINK_ROUTE) {}
src/ip_notifier.cpp:            , netlink::endpoint(netlink(NETLINK_ROUTE), RTMGRP_IPV4_IFADDR | RTMGRP_IPV6_IFADDR))
src/enum_net.cpp:       int const sock = ::socket(PF_ROUTE, SOCK_DGRAM, NETLINK_ROUTE);
src/enum_net.cpp:       int const sock = ::socket(PF_ROUTE, SOCK_DGRAM, NETLINK_ROUTE);

int socket(int domain, int type, int protocol)

The jlibtorrent java source code has no mention of NetworkInterface, so the issue must be from trying to bind a NETLINK_ROUTE socket.

Reading about Linux, I find that NETLINK sockets are used for IPC communication between kernel space and user-space

Netlink socket is a special IPC used for transferring information between kernel and user-space processes. It provides a full-duplex communication link between the two by way of standard socket APIs for user-space processes and a special kernel API for kernel modules.

NETLINK_ROUTE: communication channel between user-space routing daemons, such as BGP, OSPF, RIP and kernel packet forwarding module. User-space routing dæmons update the kernel routing table through this netlink protocol type.

Gotta read or ask libtorrent devs if they're using NETLINK_ROUTE sockets to update kernel routing tables and if this is necessary for libtorrent or if there might be a workaround, and we'll probably have to submit a patch to get this to work for Android.

I'll also check the issues over at libtorrent, perhaps somebody has already raised this issue.

gubatron commented 3 years ago

On enum_net.cpp and all the other files that use NETLINK_ROUTE sockets there are a couple of compiler flags we can use to disable NETLINK_ROUTE, called TORRENT_USE_NETLINK

Screen Shot 2021-06-07 at 3 11 21 PM

By looking at FrostWire's compilation scripts, we are not explicitly setting the TORRENT_USE_NETLINK flag, so it is my guess that this crash of yours is not caused by jlibtorrent, but due to some other library in your app, I'm not 100% certain of this, so @vickyoo7 please take a deep look at your stack (idm.internet.download.manager.plus:DownloadService) when you execute this:

02-24 16:24:34.925 E/mac-restrictions(1901): idm.internet.download.manager.plus:DownloadService tried to call bind() on a NETLINK_ROUTE socket, which is not allowed. Please follow instructions at go/netlink-bug if this app behaves incorrectly.
02-24 16:24:35.030 E/IorapForwardingService(1456): No service published for: iorapd
02-24 16:24:35.030 E/IorapForwardingService(1456): android.os.ServiceManager$ServiceNotFoundException: No service published for: iorapd

In the meantime I'm asking questions at libtorrent.

Hopefully this will be as simple as making sure that compilation flag is not set and hopefully the library will continue to work just fine on Android.

We are testing jlibtorrent on Android 11, 12 and we cannot replicate this crash, and the app is downloading torrents fine.

gubatron commented 3 years ago

Not sure if this is related, but when I run on Android 11, with target SDK 30, I'm getting a Permission Denied error message on a ListenFailed alert, FML with Android/Google.

MainApplication: ctx.interfaces = 0.0.0.0:54475,[::]:54475

com.frostwire.android I/SessionManager: onListenFailed(): iface= , address= 0.0.0.0, port= 0, socketType= TCP, errorCode= 

com.frostwire.jlibtorrent.ErrorCode@1108635

com.frostwire.android I/BTEngine: Listen failed on endpoint: 0.0.0.0:0 type:TCP (error: Permission denied/value=13)

What's also weird is that I'm not attempting to Listen on 0.0.0.0:0 (port 0), I'm attempting to listen on 54475

With no code changes, this works perfectly fine on Android 10 (SDK 29)

Things I'll be trying

If anybody has come across a similar issue would love any advice.

vickyoo7 commented 3 years ago

On enum_net.cpp and all the other files that use NETLINK_ROUTE sockets there are a couple of compiler flags we can use to disable NETLINK_ROUTE, called TORRENT_USE_NETLINK

Screen Shot 2021-06-07 at 3 11 21 PM

By looking at FrostWire's compilation scripts, we are not explicitly setting the TORRENT_USE_NETLINK flag, so it is my guess that this crash of yours is not caused by jlibtorrent, but due to some other library in your app, I'm not 100% certain of this, so @vickyoo7 please take a deep look at your stack (idm.internet.download.manager.plus:DownloadService) when you execute this:

02-24 16:24:34.925 E/mac-restrictions(1901): idm.internet.download.manager.plus:DownloadService tried to call bind() on a NETLINK_ROUTE socket, which is not allowed. Please follow instructions at go/netlink-bug if this app behaves incorrectly.
02-24 16:24:35.030 E/IorapForwardingService(1456): No service published for: iorapd
02-24 16:24:35.030 E/IorapForwardingService(1456): android.os.ServiceManager$ServiceNotFoundException: No service published for: iorapd

In the meantime I'm asking questions at libtorrent.

Hopefully this will be as simple as making sure that compilation flag is not set and hopefully the library will continue to work just fine on Android.

We are testing jlibtorrent on Android 11, 12 and we cannot replicate this crash, and the app is downloading torrents fine.

Unfortunately the logs i attached is the only stacktrace I had because it was sent by a user. I think the issue is hapening on custom ROMS. Below are some of the affected devices/roms

1) poco F1 running Android 11 (crDroid custom ROM) 2) poco F1 running Android 11 (project 404 beryllium custom ROM)

FunkyMuse commented 3 years ago

Not sure if this is related, but when I run on Android 11, with target SDK 30, I'm getting a Permission Denied error message on a ListenFailed alert, FML with Android/Google.

MainApplication: ctx.interfaces = 0.0.0.0:54475,[::]:54475

com.frostwire.android I/SessionManager: onListenFailed(): iface= , address= 0.0.0.0, port= 0, socketType= TCP, errorCode= 

com.frostwire.jlibtorrent.ErrorCode@1108635

com.frostwire.android I/BTEngine: Listen failed on endpoint: 0.0.0.0:0 type:TCP (error: Permission denied/value=13)

What's also weird is that I'm not attempting to Listen on 0.0.0.0:0 (port 0), I'm attempting to listen on 54475

With no code changes, this works perfectly fine on Android 10 (SDK 29)

Things I'll be trying

* Trying to listen on `0.0.0.0:54475` but using regular Java UDP sockets to see if I also get a permission error (then that's it)

* Check jlibtorrent and libtorrent code to see if the interfaces I'm passing to the settings pack `sp.set_str(settings_pack.string_types.listen_interfaces.swigValue(), ctx.interfaces);` is being ignored or has to be done differently now.

* Will try and see if there's a more detailed document on changes done to networking permissions on Android 11, fucking Android 11.

If anybody has come across a similar issue would love any advice.

I guess this is related to https://github.com/frostwire/frostwire-jlibtorrent/issues/238

gubatron commented 2 years ago

Finally, apparent success.

This is a new build of jlibtorrent 1.2.14.0 running on Android 11 x86 emulator. The session starts and connects to the DHT, downloads and seeds torrents using IF_ADDR sockets.

Screen Shot 2021-08-12 at 2 56 15 PM Screen Shot 2021-08-12 at 2 58 21 PM
gubatron commented 2 years ago

Works also on Android 10, SDK level 29!

Screen Shot 2021-08-12 at 2 59 52 PM Screen Shot 2021-08-12 at 3 00 51 PM
gubatron commented 2 years ago

Works on Android 9, SDK level 28

Screen Shot 2021-08-12 at 3 03 14 PM Screen Shot 2021-08-12 at 3 03 34 PM
gubatron commented 2 years ago

Session starts in Android 8.0, SDK level 26

Screen Shot 2021-08-12 at 3 11 51 PM Screen Shot 2021-08-12 at 3 12 03 PM

found a NPE

I/tDownloadsClickListener: startTorrentPartialDownload(): Attempt to invoke virtual method 'com.frostwire.jlibtorrent.Sha1Hash com.frostwire.jlibtorrent.TorrentHandle.infoHash()' on a null object reference
    java.lang.NullPointerException: Attempt to invoke virtual method 'com.frostwire.jlibtorrent.Sha1Hash com.frostwire.jlibtorrent.TorrentHandle.infoHash()' on a null object reference
        at com.frostwire.android.gui.transfers.TransferManager.updateUIBittorrentDownload(TransferManager.java:599)
        at com.frostwire.android.gui.dialogs.HandpickedTorrentDownloadDialog$OnStartDownloadsClickListener.lambda$startTorrentPartialDownload$0(HandpickedTorrentDownloadDialog.java:354)
        at com.frostwire.android.gui.dialogs.HandpickedTorrentDownloadDialog$OnStartDownloadsClickListener.lambda$startTorrentPartialDownload$0$HandpickedTorrentDownloadDialog$OnStartDownloadsClickListener(Unknown Source:0)
        at com.frostwire.android.gui.dialogs.-$$Lambda$HandpickedTorrentDownloadDialog$OnStartDownloadsClickListener$NTvqPgb_tKAptz47kXXNRzf1SVA.run(Unknown Source:4)
        at com.frostwire.android.gui.tasks.AsyncStartDownload.lambda$submitRunnable$2(AsyncStartDownload.java:109)
        at com.frostwire.android.gui.tasks.-$$Lambda$AsyncStartDownload$SgMEZ9-NcOV5_jmlnJkKNRgbqZo.run(Unknown Source:2)
        at android.os.Handler.handleCallback(Handler.java:789)
        at android.os.Handler.dispatchMessage(Handler.java:98)
        at android.os.Looper.loop(Looper.java:164)
        at android.os.HandlerThread.run(HandlerThread.java:65)
gubatron commented 2 years ago

Session starts in Android 7.1.1 - SDK level 25

Screen Shot 2021-08-12 at 3 35 42 PM Screen Shot 2021-08-12 at 3 35 57 PM
gubatron commented 2 years ago

Session starts in Android 7.0 - SDK level 24

Screen Shot 2021-08-12 at 3 43 47 PM Screen Shot 2021-08-12 at 3 43 34 PM
gubatron commented 2 years ago

that's as low as it goes. Now have to test on a real device with an ARM64 chip

gubatron commented 2 years ago

Closing this issue. The fix will be included in the 1.2.14.0 build that will be released soon for all android architectures.

gubatron commented 2 years ago

Binaries for jlibtorrent 1.2.14.0 are now available, these should be good for android developers to keep supporting libtorrent sessions on Android 11 and above.

gubatron commented 2 years ago

Thank you everybody for your continued support, this was one tough ticket to close.

vickyoo7 commented 2 years ago

Binaries for jlibtorrent 1.2.14.0 are now available, these should be good for android developers to keep supporting libtorrent sessions on Android 11 and above.

That is excellent news. I'll update the library and confirm. Thank you for your hard work

gubatron commented 2 years ago

fingers crossed this will work for you @vickyoo7

vickyoo7 commented 2 years ago

fingers crossed this will work for you @vickyoo7

Thanks. btw is support for api < 24 dropped?

gubatron commented 2 years ago

yes, there was no other way

gubatron commented 2 years ago

even google I believe is dropping support for gmail to such old devices

gubatron commented 2 years ago

I'm still testing, so there's a chance I'll be uploading a 1.2.14.1 during the weekend or next week.

vickyoo7 commented 2 years ago

yes, there was no other way

Ok thanks for the info. According to google almost 27% device still use api 23 or below so it'll be a tough decision whether to update it or not

vickyoo7 commented 2 years ago

I'm still testing, so there's a chance I'll be uploading a 1.2.14.1 during the weekend or next week.

Okay

gubatron commented 2 years ago

yup, will have to re-upload a few binaries that I compiled with api < 24, duh.

vickyoo7 commented 2 years ago

yup, will have to re-upload a few binaries that I compiled with api < 24, duh.

That would be awesome. Thanks

vickyoo7 commented 2 years ago

yup, will have to re-upload a few binaries that I compiled with api < 24, duh.

Is it possible to have only one build? Not sure aab format supports .so files based on api version

gubatron commented 2 years ago

Working android binaries are up, just tested on Android 11 and arm64, working perfectly.

gubatron commented 2 years ago

Is it possible to have only one build? Not sure aab format supports .so files based on api version

We've always had different builds, some with API 19, some with API 21 in the past. We distribute also using the Android App Bundle (aab format) and it worked fine for all the architectures.

Now they're all built with api level 24.

gubatron commented 2 years ago

According to google almost 27% device still use api 23 or below so it'll be a tough decision whether to update it or not

We had less than that (under 10% If I remember), but the decision will be made easy after November, they're pushing aggressively towards Android 11 and 12, I believe they have regulatory pressure towards stronger privacy policies, this I think might be a reason why they blocked netlink sockets and why after november they're allowing WRITE_EXTERNAL permissions for apps that file a petition and which can demonstrate they need to have such permission or else break. We've been refactoring all summer to use their new Media Store api to work with jlibtorrent.

vickyoo7 commented 2 years ago

Is it possible to have only one build? Not sure aab format supports .so files based on api version

We've always had different builds, some with API 19, some with API 21 in the past. We distribute also using the Android App Bundle (aab format) and it worked fine for all the architectures.

Now they're all built with api level 24.

I meant in a single aab package can we have multiple arm64 libs (one for api >= 24 and other for api < 24)? I think not, I may be wrong though

PS: lollipop+ supports 64 bit arch

gubatron commented 2 years ago

that makes sense, I need to see how to do this from a gradle script though. For now it's really helpful to have individual .jars for testing on different devices and emulators.

A patch on build.gradle with a taskAndroidAppBundle would be most welcome.

vickyoo7 commented 2 years ago

that makes sense, I need to see how to do this from a gradle script though. For now it's really helpful to have individual .jars for testing on different devices and emulators.

A patch on build.gradle with a taskAndroidAppBundle would be most welcome.

is it possible to check for api version or ifdef and call the available function in the source code itself so multiple builds are not required?