tobexyz / yaacc-code

YAACC - UPNP Client and Server
Other
94 stars 13 forks source link

phone hangs #34

Closed 532910 closed 1 year ago

532910 commented 5 years ago

With the last update: I start the app. Got App doesn't responding close it? Doesn't matter what I will answer, soft buttons stop working. The only way is to reboot phone with power button.

Android 9 LineageOS 16.0

tobexyz commented 5 years ago

thank you for reporting this bug. Did you use the version 2.2.0 before? If so, it may helps to clear the app data and app cache. I don't use LineageOS but I was now able to test yaacc in version 2.3.0 on an Android 9 device. On that device I saw "App doesn't responding close it?" directly after the start. After selecting 'wait', the app works as expected. Other previous bug reports about the hanging app came also from people using LinageOS. I think we need help from someone who can debug the app on such devices.

532910 commented 5 years ago

Just "cleared storage" but this doesn't help.

532910 commented 5 years ago

some from logcat

04-14 13:48:54.128 17924 17924 W de.yaacc: Insufficient pre-allocated space to mmap vdex.

04-14 13:48:54.340 17924 17957 E DatagramIO: Exception sending datagram to: /239.255.255.250: java.io.IOException: sendto failed: EPERM (Operation not permitted)
04-14 13:48:54.340 17924 17957 E DatagramIO: java.io.IOException: sendto failed: EPERM (Operation not permitted)
04-14 13:48:54.340 17924 17957 E DatagramIO:    at libcore.io.IoBridge.maybeThrowAfterSendto(IoBridge.java:576)
04-14 13:48:54.340 17924 17957 E DatagramIO:    at libcore.io.IoBridge.sendto(IoBridge.java:544)
04-14 13:48:54.340 17924 17957 E DatagramIO:    at java.net.PlainDatagramSocketImpl.send(PlainDatagramSocketImpl.java:125)
04-14 13:48:54.340 17924 17957 E DatagramIO:    at java.net.DatagramSocket.send(DatagramSocket.java:721)
04-14 13:48:54.340 17924 17957 E DatagramIO:    at org.fourthline.cling.transport.impl.DatagramIOImpl.send(DatagramIOImpl.java:159)
04-14 13:48:54.340 17924 17957 E DatagramIO:    at org.fourthline.cling.transport.impl.DatagramIOImpl.send(DatagramIOImpl.java:150)
04-14 13:48:54.340 17924 17957 E DatagramIO:    at org.fourthline.cling.transport.RouterImpl.send(RouterImpl.java:309)
04-14 13:48:54.340 17924 17957 E DatagramIO:    at org.fourthline.cling.protocol.async.SendingSearch.execute(SendingSearch.java:91)
04-14 13:48:54.340 17924 17957 E DatagramIO:    at org.fourthline.cling.protocol.SendingAsync.run(SendingAsync.java:54)
04-14 13:48:54.340 17924 17957 E DatagramIO:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
04-14 13:48:54.340 17924 17957 E DatagramIO:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
04-14 13:48:54.340 17924 17957 E DatagramIO:    at java.lang.Thread.run(Thread.java:764)
04-14 13:48:54.340 17924 17957 E DatagramIO: Caused by: android.system.ErrnoException: sendto failed: EPERM (Operation not permitted)
04-14 13:48:54.340 17924 17957 E DatagramIO:    at libcore.io.Linux.sendtoBytes(Native Method)
04-14 13:48:54.340 17924 17957 E DatagramIO:    at libcore.io.Linux.sendto(Linux.java:227)
04-14 13:48:54.340 17924 17957 E DatagramIO:    at libcore.io.BlockGuardOs.sendto(BlockGuardOs.java:307)
04-14 13:48:54.340 17924 17957 E DatagramIO:    at libcore.io.IoBridge.sendto(IoBridge.java:542)
04-14 13:48:54.340 17924 17957 E DatagramIO:    ... 10 more

04-14 13:48:54.472 17924 17949 D de.yaacc.upnp.UpnpClient: remoteDeviceAdded: Justin Maggard Windows Media Connect compatible (MiniDLNA) 1
04-14 13:48:54.483 17924 17924 D de.yaacc.browser.BrowseDeviceAdapter: Device icon uri:http://10.8.8.8:8200/icons/sm.png
04-14 13:48:54.485 17924 17962 D de.yaacc.util.image.ImageDownloader: retrieveImage size:48x48
04-14 13:48:54.485 17924 17962 D de.yaacc.util.image.ImageDownloader: Start load: 1555238934485
04-14 13:48:54.485 17924 17962 D NetworkSecurityConfig: No Network Security Config specified, using platform default
04-14 13:48:54.491   564   609 W SurfaceFlinger: Attempting to set client state on removed layer: Splash Screen de.yaacc#0
04-14 13:48:54.491   564   609 W SurfaceFlinger: Attempting to destroy on removed layer: Splash Screen de.yaacc#0
04-14 13:48:54.495 17924 17962 D de.yaacc.util.image.ImageDownloader: Stop load: 1555238934495
04-14 13:48:54.495 17924 17962 D de.yaacc.util.image.ImageDownloader: InputStream: buffer(com.android.okhttp.internal.http.Http1xStream$FixedLengthSource@858016c).inputStream()
04-14 13:48:54.495 17924 17962 D de.yaacc.util.image.ImageDownloader: displaying image size width, height, inSampleSize 48,48,0
04-14 13:48:54.495 17924 17962 D de.yaacc.util.image.ImageDownloader: free memory before image load: 0
04-14 13:48:54.499 17924 17962 D de.yaacc.util.image.ImageDownloader: free memory after image load: 0
04-14 13:48:54.844 17924 17957 E DatagramIO: Exception sending datagram to: /239.255.255.250: java.io.IOException: sendto failed: EPERM (Operation not permitted)
04-14 13:48:54.844 17924 17957 E DatagramIO: java.io.IOException: sendto failed: EPERM (Operation not permitted)
04-14 13:48:54.844 17924 17957 E DatagramIO:    at libcore.io.IoBridge.maybeThrowAfterSendto(IoBridge.java:576)
04-14 13:48:54.844 17924 17957 E DatagramIO:    at libcore.io.IoBridge.sendto(IoBridge.java:544)
04-14 13:48:54.844 17924 17957 E DatagramIO:    at java.net.PlainDatagramSocketImpl.send(PlainDatagramSocketImpl.java:125)
04-14 13:48:54.844 17924 17957 E DatagramIO:    at java.net.DatagramSocket.send(DatagramSocket.java:721)
04-14 13:48:54.844 17924 17957 E DatagramIO:    at org.fourthline.cling.transport.impl.DatagramIOImpl.send(DatagramIOImpl.java:159)
04-14 13:48:54.844 17924 17957 E DatagramIO:    at org.fourthline.cling.transport.impl.DatagramIOImpl.send(DatagramIOImpl.java:150)
04-14 13:48:54.844 17924 17957 E DatagramIO:    at org.fourthline.cling.transport.RouterImpl.send(RouterImpl.java:309)
04-14 13:48:54.844 17924 17957 E DatagramIO:    at org.fourthline.cling.protocol.async.SendingSearch.execute(SendingSearch.java:91)
04-14 13:48:54.844 17924 17957 E DatagramIO:    at org.fourthline.cling.protocol.SendingAsync.run(SendingAsync.java:54)
04-14 13:48:54.844 17924 17957 E DatagramIO:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
04-14 13:48:54.844 17924 17957 E DatagramIO:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
04-14 13:48:54.844 17924 17957 E DatagramIO:    at java.lang.Thread.run(Thread.java:764)
04-14 13:48:54.844 17924 17957 E DatagramIO: Caused by: android.system.ErrnoException: sendto failed: EPERM (Operation not permitted)
04-14 13:48:54.844 17924 17957 E DatagramIO:    at libcore.io.Linux.sendtoBytes(Native Method)
04-14 13:48:54.844 17924 17957 E DatagramIO:    at libcore.io.Linux.sendto(Linux.java:227)
04-14 13:48:54.844 17924 17957 E DatagramIO:    at libcore.io.BlockGuardOs.sendto(BlockGuardOs.java:307)
04-14 13:48:54.844 17924 17957 E DatagramIO:    at libcore.io.IoBridge.sendto(IoBridge.java:542)
04-14 13:48:54.844 17924 17957 E DatagramIO:    ... 10 more
04-14 13:48:54.864 17924 17950 D de.yaacc.upnp.UpnpClient: remoteDeviceUpdated: Justin Maggard Windows Media Connect compatible (MiniDLNA) 1
04-14 13:48:54.865 17924 17949 D de.yaacc.upnp.UpnpClient: remoteDeviceUpdated: Justin Maggard Windows Media Connect compatible (MiniDLNA) 1
04-14 13:48:54.869 17924 17924 D de.yaacc.browser.BrowseDeviceAdapter: Device icon uri:http://10.8.8.8:8200/icons/sm.png
04-14 13:48:54.870 17924 17965 D de.yaacc.util.image.ImageDownloader: retrieveImage size:48x48
04-14 13:48:54.870 17924 17965 D de.yaacc.util.image.ImageDownloader: Start load: 1555238934870
04-14 13:48:54.880 17924 17965 D de.yaacc.util.image.ImageDownloader: Stop load: 1555238934880
04-14 13:48:54.881 17924 17965 D de.yaacc.util.image.ImageDownloader: InputStream: buffer(com.android.okhttp.internal.http.Http1xStream$FixedLengthSource@448e222).inputStream()
04-14 13:48:54.881 17924 17965 D de.yaacc.util.image.ImageDownloader: displaying image size width, height, inSampleSize 48,48,0
04-14 13:48:54.881 17924 17965 D de.yaacc.util.image.ImageDownloader: free memory before image load: 4489104
04-14 13:48:54.882 17924 17965 D de.yaacc.util.image.ImageDownloader: free memory after image load: 4489104
04-14 13:48:55.353 17924 17957 E DatagramIO: Exception sending datagram to: /239.255.255.250: java.io.IOException: sendto failed: EPERM (Operation not permitted)
04-14 13:48:55.353 17924 17957 E DatagramIO: java.io.IOException: sendto failed: EPERM (Operation not permitted)
04-14 13:48:55.353 17924 17957 E DatagramIO:    at libcore.io.IoBridge.maybeThrowAfterSendto(IoBridge.java:576)
04-14 13:48:55.353 17924 17957 E DatagramIO:    at libcore.io.IoBridge.sendto(IoBridge.java:544)
04-14 13:48:55.353 17924 17957 E DatagramIO:    at java.net.PlainDatagramSocketImpl.send(PlainDatagramSocketImpl.java:125)
04-14 13:48:55.353 17924 17957 E DatagramIO:    at java.net.DatagramSocket.send(DatagramSocket.java:721)
04-14 13:48:55.353 17924 17957 E DatagramIO:    at org.fourthline.cling.transport.impl.DatagramIOImpl.send(DatagramIOImpl.java:159)
04-14 13:48:55.353 17924 17957 E DatagramIO:    at org.fourthline.cling.transport.impl.DatagramIOImpl.send(DatagramIOImpl.java:150)
04-14 13:48:55.353 17924 17957 E DatagramIO:    at org.fourthline.cling.transport.RouterImpl.send(RouterImpl.java:309)
04-14 13:48:55.353 17924 17957 E DatagramIO:    at org.fourthline.cling.protocol.async.SendingSearch.execute(SendingSearch.java:91)
04-14 13:48:55.353 17924 17957 E DatagramIO:    at org.fourthline.cling.protocol.SendingAsync.run(SendingAsync.java:54)
04-14 13:48:55.353 17924 17957 E DatagramIO:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
04-14 13:48:55.353 17924 17957 E DatagramIO:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
04-14 13:48:55.353 17924 17957 E DatagramIO:    at java.lang.Thread.run(Thread.java:764)
04-14 13:48:55.353 17924 17957 E DatagramIO: Caused by: android.system.ErrnoException: sendto failed: EPERM (Operation not permitted)
04-14 13:48:55.353 17924 17957 E DatagramIO:    at libcore.io.Linux.sendtoBytes(Native Method)
04-14 13:48:55.353 17924 17957 E DatagramIO:    at libcore.io.Linux.sendto(Linux.java:227)
04-14 13:48:55.353 17924 17957 E DatagramIO:    at libcore.io.BlockGuardOs.sendto(BlockGuardOs.java:307)
04-14 13:48:55.353 17924 17957 E DatagramIO:    at libcore.io.IoBridge.sendto(IoBridge.java:542)
04-14 13:48:55.353 17924 17957 E DatagramIO:    ... 10 more
04-14 13:48:55.407 17924 17950 D de.yaacc.upnp.UpnpClient: remoteDeviceUpdated: Justin Maggard Windows Media Connect compatible (MiniDLNA) 1
04-14 13:48:55.409 17924 17950 D de.yaacc.upnp.UpnpClient: remoteDeviceUpdated: Justin Maggard Windows Media Connect compatible (MiniDLNA) 1
04-14 13:48:55.422 17924 17924 D de.yaacc.browser.BrowseDeviceAdapter: Device icon uri:http://10.8.8.8:8200/icons/sm.png
04-14 13:48:55.423 17924 17966 D de.yaacc.util.image.ImageDownloader: retrieveImage size:48x48
04-14 13:48:55.424 17924 17966 D de.yaacc.util.image.ImageDownloader: Start load: 1555238935424
04-14 13:48:55.433 17924 17966 D de.yaacc.util.image.ImageDownloader: Stop load: 1555238935433
04-14 13:48:55.434 17924 17966 D de.yaacc.util.image.ImageDownloader: InputStream: buffer(com.android.okhttp.internal.http.Http1xStream$FixedLengthSource@f82272b).inputStream()
04-14 13:48:55.434 17924 17966 D de.yaacc.util.image.ImageDownloader: displaying image size width, height, inSampleSize 48,48,0
04-14 13:48:55.434 17924 17966 D de.yaacc.util.image.ImageDownloader: free memory before image load: 0
04-14 13:48:55.436 17924 17966 D de.yaacc.util.image.ImageDownloader: free memory after image load: 0
04-14 13:48:55.439 17924 17924 D de.yaacc.browser.BrowseDeviceAdapter: Device icon uri:http://10.8.8.8:8200/icons/sm.png
04-14 13:48:55.868 17924 17957 E DatagramIO: Exception sending datagram to: /239.255.255.250: java.io.IOException: sendto failed: EPERM (Operation not permitted)

04-14 13:49:04.758 17924 17930 I de.yaacc: Thread[3,tid=17930,WaitingInMainSignalCatcherLoop,Thread*=0x7eb0c16400,peer=0x195c01c0,"Signal Catcher"]: reacting to signal 3
04-14 13:49:04.758 17924 17930 I de.yaacc: 
tobexyz commented 5 years ago

Thank you for the log!! About the warningde.yaacc: Insufficient pre-allocated space to mmap vdex. I found a thread on stackoverflow addressing Android P with custom roms , but without an answer :-( https://stackoverflow.com/questions/54415062/how-to-fix-the-insufficient-pre-allocated-space-to-mmap-vdex-issue-on-android The other one Exception sending datagram to: /239.255.255.250: java.io.IOException: sendto failed: EPERM (Operation not permitted) seems to be a bug in cling. There is an issue for it: https://github.com/4thline/cling/issues/224 I have to take a deeper look on it.

532910 commented 5 years ago

de.yaacc: Insufficient pre-allocated space to mmap vdex. Exception sending datagram to: /239.255.255.250: java.io.IOException: sendto failed: EPERM (Operation not permitted)

I'm not sure, but suppose this is not the problem that deactivates soft buttons.

TheNetStriker commented 5 years ago

I'am also looking for a solution for the EPERM error. Disabling the mobile network acutally solves the problem, but I'm looking for a way that it also works when the mobile network is active.

I found out that cling uses the ip from the mobile network as primary ip to send data to my wlan device. So I tried to exclude this network from cling by modifying the isUsableNetworkInterface method of NetworkAddressFactoryImpl.java and simply added this:

if (iface.getName().toLowerCase(Locale.ROOT).startsWith("rmnet")) { log.finer("Skipping network interface (RMNET): " + iface.getDisplayName()); return false; }

This solved the EPERM error, but for some reason the http calls now run into a timeout. Maybe the network needs to be excluded only when sending from the multicast socket. I will post again if I find any solution for this.

TheNetStriker commented 5 years ago

I did some more tests and I think I know what causes my problem. I'm trying to connect directly to a upnp device over wlan that doesn't provide an internet connection. I tried to ping the wlan device using adb shell with mobile data on and off and the ping only worked when mobile data is off. But the ping worked with mobile data on if I explicitly set the interface that should be used by adding the -I wlan0 parameter. It seems this is a routing problem of Android. (Or maybe it is intended to work like this)

The fix I found works for the multicast packets because they use a MulticastSocket connection where the primary interface can be set. But it doesn't work when requesting the http data after that using the HttpURLConnection. The problem is that the HttpURLConnection does not have a method to set the primary network interface to send the data from as described here.

To solve this problem the whole library would have to be changed to use Sockets (or another http library if there is any) to send the http data over a specific interface. But this is too much work for me. I'm now just displaying a warning in my app when mobile data is active.

tobexyz commented 5 years ago

@TheNetStriker Thank you for your work on this problem. Did your device stops hanging when disabling mobile data? If so it would be useful to integrate the warning in yaacc and show it if using newer Android versions.

TheNetStriker commented 5 years ago

@tobexyz No my app did not hang because of this problem. The upnp device was simply not recognized because of this routing problem.

tobexyz commented 5 years ago

@TheNetStriker ok, so switching off mobile data would help to fix the discovery problems. That's information might be helpful for others. As long as we don't know how to get around without a huge refactoring of cling, the warning seem to be an easy solution for the moment. Do you want open a pull request for that?

tobexyz commented 1 year ago

Will be fixed in 3.0.0