jitsi/ice4j

Fails in Android ice4j version > 2.0

KORuL opened this issue · 3 comments

KORuL commented

I used this version of the library ice4j-2.0.0-20180323.195541-7.jar because the following versions require android api > 24
I get the following type of exceptions java.net.SocketException: sendto failed: EPERM (Operation not permitted)

The latest working version for android devoid of this exception - ice4j-2.0-20170719.193045-19.jar

D/libc-netbsd: [getaddrinfo]: mtk hostname=62.176.10.54; servname=(null); netid=0; mark=0
    getaddrinfo( app_uid:10115
    getaddrinfo() uid prop:
    getaddrinfo() getuid():10115
    [getaddrinfo]: mtk ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0
W/System.err: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
    SLF4J: Defaulting to no-operation (NOP) logger implementation
    SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
I/OpenGLRenderer: Initialized EGL, version 1.4
E/OpenGLRenderer: PerfServiceNative_notifyRenderTime init fail!
I/OpenGLRenderer: Get enable program binary service property (1)
I/OpenGLRenderer: Program binary detail: Binary length is 173456, program map length is 152.
    Succeeded to mmap program binaries. File descriptor is 49, and path is /dev/ashmem��.
    No need to use file discriptor anymore, close fd(49).
W/libEGL: [ANDROID_RECORDABLE] format: 1
D/libc-netbsd: [getaddrinfo]: mtk hostname=62.176.10.54; servname=(null); netid=0; mark=0
D/libc-netbsd: getaddrinfo( app_uid:10115
    getaddrinfo() uid prop:
    getaddrinfo() getuid():10115
    [getaddrinfo]: mtk ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0
D/libc-netbsd: [getaddrinfo]: mtk hostname=62.176.10.54; servname=(null); netid=0; mark=0
    getaddrinfo( app_uid:10115
D/libc-netbsd: getaddrinfo() uid prop:
    getaddrinfo() getuid():10115
    [getaddrinfo]: mtk ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0
I/System.out: [CDS]SO_RCVBUF:2097152
D/libc-netbsd: [getaddrinfo]: mtk hostname=62.176.10.54; servname=(null); netid=0; mark=0
    getaddrinfo( app_uid:10115
    getaddrinfo() uid prop:
    getaddrinfo() getuid():10115
    [getaddrinfo]: mtk ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0
W/art: Before Android 4.1, method int android.support.v7.widget.DropDownListView.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
I/System.out: http://169.254.169.254/latest/meta-data/
D/libc-netbsd: [getaddrinfo]: mtk hostname=169.254.169.254; servname=(null); netid=0; mark=0
D/libc-netbsd: getaddrinfo( app_uid:10115
    getaddrinfo() uid prop:
    getaddrinfo() getuid():10115
    [getaddrinfo]: mtk ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0
    [getaddrinfo]: mtk hostname=169.254.169.254; servname=(null); netid=0; mark=0
    getaddrinfo( app_uid:10115
D/libc-netbsd: getaddrinfo() uid prop:
    getaddrinfo() getuid():10115
    [getaddrinfo]: mtk ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0
I/pingCandidateHarvesters: Initialized mapping harvesters (delay=511ms).  stunDiscoveryFailed=false
D/libc-netbsd: [getaddrinfo]: mtk hostname=62.176.10.54; servname=(null); netid=0; mark=0
D/libc-netbsd: getaddrinfo( app_uid:10115
    getaddrinfo() uid prop:
    getaddrinfo() getuid():10115
    [getaddrinfo]: mtk ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0
D/libc-netbsd: [getaddrinfo]: mtk hostname=62.176.10.54; servname=(null); netid=0; mark=0
    getaddrinfo( app_uid:10115
    getaddrinfo() uid prop:
    getaddrinfo() getuid():10115
D/libc-netbsd: [getaddrinfo]: mtk ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0
I/org.ice4j.ice.Agent: Gathering candidates for component data.RTP. Local ufrag 2ok7v1cukdh27j
I/StunCandidateHarvest: Failed to send ALLOCATE-REQUEST(0x3)[attrib.count=3 len=32 tranID=0x998BD8A8670107DF3F4757E9] through 192.168.0.105:6000/udp to 62.176.10.54:3478/udp
    java.net.SocketException: sendto failed: EPERM (Operation not permitted)
        at libcore.io.IoBridge.maybeThrowAfterSendto(IoBridge.java:652)
        at libcore.io.IoBridge.sendto(IoBridge.java:621)
        at java.net.PlainDatagramSocketImpl.send(PlainDatagramSocketImpl.java:184)
        at java.net.DatagramSocket.send(DatagramSocket.java:305)
        at org.ice4j.socket.DelegatingDatagramSocket.send(DelegatingDatagramSocket.java:732)
        at org.ice4j.socket.DelegatingDatagramSocket.send(DelegatingDatagramSocket.java:776)
        at org.ice4j.socket.IceUdpSocketWrapper.send(IceUdpSocketWrapper.java:53)
        at org.ice4j.stack.Connector.sendMessage(Connector.java:327)
        at org.ice4j.stack.NetAccessManager.sendMessage(NetAccessManager.java:629)
        at org.ice4j.stack.NetAccessManager.sendMessage(NetAccessManager.java:575)
        at org.ice4j.stack.StunClientTransaction.sendRequest0(StunClientTransaction.java:394)
        at org.ice4j.stack.StunClientTransaction.sendRequest(StunClientTransaction.java:372)
        at org.ice4j.stack.StunStack.sendRequest(StunStack.java:689)
        at org.ice4j.stack.StunStack.sendRequest(StunStack.java:627)
        at org.ice4j.ice.harvest.StunCandidateHarvest.sendRequest(StunCandidateHarvest.java:1300)
        at org.ice4j.ice.harvest.StunCandidateHarvest.startResolvingCandidate(StunCandidateHarvest.java:1405)
        at org.ice4j.ice.harvest.StunCandidateHarvester.startResolvingCandidate(StunCandidateHarvester.java:340)
        at org.ice4j.ice.harvest.StunCandidateHarvester.harvest(StunCandidateHarvester.java:252)
        at org.ice4j.ice.harvest.CandidateHarvesterSetElement.harvest(CandidateHarvesterSetElement.java:86)
        at org.ice4j.ice.harvest.CandidateHarvesterSetTask.run(CandidateHarvesterSetTask.java:107)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
        at java.lang.Thread.run(Thread.java:818)
     Caused by: android.system.ErrnoException: sendto failed: EPERM (Operation not permitted)
        at libcore.io.Posix.sendtoBytes(Native Method)
        at libcore.io.Posix.sendto(Posix.java:212)
        at libcore.io.BlockGuardOs.sendto(BlockGuardOs.java:278)
        at libcore.io.IoBridge.sendto(IoBridge.java:619)
        at java.net.PlainDatagramSocketImpl.send(PlainDatagramSocketImpl.java:184) 
        at java.net.DatagramSocket.send(DatagramSocket.java:305) 
        at org.ice4j.socket.DelegatingDatagramSocket.send(DelegatingDatagramSocket.java:732) 
        at org.ice4j.socket.DelegatingDatagramSocket.send(DelegatingDatagramSocket.java:776) 
        at org.ice4j.socket.IceUdpSocketWrapper.send(IceUdpSocketWrapper.java:53) 
        at org.ice4j.stack.Connector.sendMessage(Connector.java:327) 
        at org.ice4j.stack.NetAccessManager.sendMessage(NetAccessManager.java:629) 
        at org.ice4j.stack.NetAccessManager.sendMessage(NetAccessManager.java:575) 
        at org.ice4j.stack.StunClientTransaction.sendRequest0(StunClientTransaction.java:394) 
        at org.ice4j.stack.StunClientTransaction.sendRequest(StunClientTransaction.java:372) 
        at org.ice4j.stack.StunStack.sendRequest(StunStack.java:689) 
        at org.ice4j.stack.StunStack.sendRequest(StunStack.java:627) 
        at org.ice4j.ice.harvest.StunCandidateHarvest.sendRequest(StunCandidateHarvest.java:1300) 
        at org.ice4j.ice.harvest.StunCandidateHarvest.startResolvingCandidate(StunCandidateHarvest.java:1405) 
        at org.ice4j.ice.harvest.StunCandidateHarvester.startResolvingCandidate(StunCandidateHarvester.java:340) 
        at org.ice4j.ice.harvest.StunCandidateHarvester.harvest(StunCandidateHarvester.java:252) 
        at org.ice4j.ice.harvest.CandidateHarvesterSetElement.harvest(CandidateHarvesterSetElement.java:86) 
        at org.ice4j.ice.harvest.CandidateHarvesterSetTask.run(CandidateHarvesterSetTask.java:107) 
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
        at java.lang.Thread.run(Thread.java:818) 
I/StunCandidateHarvester: Failed to start resolving host candidate candidate:2 1 udp 2130706431 192.168.0.105 6000 typ host
    org.ice4j.StunException: sendto failed: EPERM (Operation not permitted)
        at org.ice4j.ice.harvest.StunCandidateHarvest.sendRequest(StunCandidateHarvest.java:1338)
        at org.ice4j.ice.harvest.StunCandidateHarvest.startResolvingCandidate(StunCandidateHarvest.java:1405)
        at org.ice4j.ice.harvest.StunCandidateHarvester.startResolvingCandidate(StunCandidateHarvester.java:340)
        at org.ice4j.ice.harvest.StunCandidateHarvester.harvest(StunCandidateHarvester.java:252)
        at org.ice4j.ice.harvest.CandidateHarvesterSetElement.harvest(CandidateHarvesterSetElement.java:86)
        at org.ice4j.ice.harvest.CandidateHarvesterSetTask.run(CandidateHarvesterSetTask.java:107)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
        at java.lang.Thread.run(Thread.java:818)
     Caused by: java.net.SocketException: sendto failed: EPERM (Operation not permitted)
        at libcore.io.IoBridge.maybeThrowAfterSendto(IoBridge.java:652)
        at libcore.io.IoBridge.sendto(IoBridge.java:621)
        at java.net.PlainDatagramSocketImpl.send(PlainDatagramSocketImpl.java:184)
        at java.net.DatagramSocket.send(DatagramSocket.java:305)
        at org.ice4j.socket.DelegatingDatagramSocket.send(DelegatingDatagramSocket.java:732)
        at org.ice4j.socket.DelegatingDatagramSocket.send(DelegatingDatagramSocket.java:776)
        at org.ice4j.socket.IceUdpSocketWrapper.send(IceUdpSocketWrapper.java:53)
        at org.ice4j.stack.Connector.sendMessage(Connector.java:327)
        at org.ice4j.stack.NetAccessManager.sendMessage(NetAccessManager.java:629)
        at org.ice4j.stack.NetAccessManager.sendMessage(NetAccessManager.java:575)
        at org.ice4j.stack.StunClientTransaction.sendRequest0(StunClientTransaction.java:394)
        at org.ice4j.stack.StunClientTransaction.sendRequest(StunClientTransaction.java:372)
        at org.ice4j.stack.StunStack.sendRequest(StunStack.java:689)
        at org.ice4j.stack.StunStack.sendRequest(StunStack.java:627)
        at org.ice4j.ice.harvest.StunCandidateHarvest.sendRequest(StunCandidateHarvest.java:1300)
        at org.ice4j.ice.harvest.StunCandidateHarvest.startResolvingCandidate(StunCandidateHarvest.java:1405) 
        at org.ice4j.ice.harvest.StunCandidateHarvester.startResolvingCandidate(StunCandidateHarvester.java:340) 
        at org.ice4j.ice.harvest.StunCandidateHarvester.harvest(StunCandidateHarvester.java:252) 
        at org.ice4j.ice.harvest.CandidateHarvesterSetElement.harvest(CandidateHarvesterSetElement.java:86) 
        at org.ice4j.ice.harvest.CandidateHarvesterSetTask.run(CandidateHarvesterSetTask.java:107) 
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
        at java.lang.Thread.run(Thread.java:818) 
     Caused by: android.system.ErrnoException: sendto failed: EPERM (Operation not permitted)
        at libcore.io.Posix.sendtoBytes(Native Method)
        at libcore.io.Posix.sendto(Posix.java:212)
        at libcore.io.BlockGuardOs.sendto(BlockGuardOs.java:278)
        at libcore.io.IoBridge.sendto(IoBridge.java:619)
        at java.net.PlainDatagramSocketImpl.send(PlainDatagramSocketImpl.java:184) 
        at java.net.DatagramSocket.send(DatagramSocket.java:305) 
        at org.ice4j.socket.DelegatingDatagramSocket.send(DelegatingDatagramSocket.java:732) 
        at org.ice4j.socket.DelegatingDatagramSocket.send(DelegatingDatagramSocket.java:776) 
        at org.ice4j.socket.IceUdpSocketWrapper.send(IceUdpSocketWrapper.java:53) 
        at org.ice4j.stack.Connector.sendMessage(Connector.java:327) 
        at org.ice4j.stack.NetAccessManager.sendMessage(NetAccessManager.java:629) 
        at org.ice4j.stack.NetAccessManager.sendMessage(NetAccessManager.java:575) 
        at org.ice4j.stack.StunClientTransaction.sendRequest0(StunClientTransaction.java:394) 
        at org.ice4j.stack.StunClientTransaction.sendRequest(StunClientTransaction.java:372) 
        at org.ice4j.stack.StunStack.sendRequest(StunStack.java:689) 
        at org.ice4j.stack.StunStack.sendRequest(StunStack.java:627) 
        at org.ice4j.ice.harvest.StunCandidateHarvest.sendRequest(StunCandidateHarvest.java:1300) 
        at org.ice4j.ice.harvest.StunCandidateHarvest.startResolvingCandidate(StunCandidateHarvest.java:1405) 
        at org.ice4j.ice.harvest.StunCandidateHarvester.startResolvingCandidate(StunCandidateHarvester.java:340) 
        at org.ice4j.ice.harvest.StunCandidateHarvester.harvest(StunCandidateHarvester.java:252) 
        at org.ice4j.ice.harvest.CandidateHarvesterSetElement.harvest(CandidateHarvesterSetElement.java:86) 
        at org.ice4j.ice.harvest.CandidateHarvesterSetTask.run(CandidateHarvesterSetTask.java:107) 
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
        at java.lang.Thread.run(Thread.java:818) 
W/StunCandidateHarvester: harvest did not start, removed: org.ice4j.ice.harvest.TurnCandidateHarvest@ee9fb96
I/org.ice4j.ice.Agent: Gathering candidates for component data.RTP. Local ufrag 2ok7v1cukdh27j
I/HostCandidateHarvester: Retrying a bind because of a failure to bind to address /fe80::1ecd:e5ff:fe5d:45f9%wlan0%18 and port 6000 (bind failed: EADDRINUSE (Address already in use))
I/HostCandidateHarvester: Retrying a bind because of a failure to bind to address /192.168.0.105 and port 6000 (bind failed: EADDRINUSE (Address already in use))
I/org.ice4j.ice.Agent: Gathering candidates for component data.RTCP. Local ufrag 2ok7v1cukdh27j

What is your use case of using ice4j on Android? Maybe it will be easier to use WebRTC for Android with no media if the goal to bypass NAT for data transfer, for example

KORuL commented

webrtc does not exactly what I need. I need to break through nat, and guaranteed delivery, pseudotcp does everything I need perfectly, I just really want to use the most current version.

KORuL commented

The easiest solution I found is to stop using your library and switch to libjingle. Because you are not ready to help with advice. In libjingle there are no such problems, everything works out of the box perfectly.