-
Notifications
You must be signed in to change notification settings - Fork 1
Description
I have created an activity called ASAPExampleTCPEncounterActivity.
This activity enables establishing a TCP/IP connection to ASAPPeers within the same TCP/IP network as the ASAPAndroidPeer.
The target ASAPPeer should provide a TCP ServerSocket to which ASAPAndroid can connect.
For this purpose, I have added the package tcpEncounter. Inside this package there is the class TCPEncounterManagerApplicationSide.java for triggering the establishment of the TCP/IP connection to the target peer on app side. On service side there is the class TCPClientSocketThread which starts a thread for establashing a TCP connection to a ServerSocket and passes the sockets to an EncounterManager.
However, when establishing the TCP/IP connection to a target peer, the following StackOverflowError occurs:
2024-09-18 12:39:08.394 10992-11060 System.out net.sharksystem.asap.android I ASAPEncounterManagerImpl(Y7lMIou0000WEN): socket called: handle new encounterStreamPair (no ID)
2024-09-18 12:39:08.394 10992-11060 System.out net.sharksystem.asap.android I ASAPEncounterManagerImpl(Y7lMIou0000WEN): device/peer not in encounteredDevices - should connect
2024-09-18 12:39:08.395 10992-11060 System.out net.sharksystem.asap.android I ASAPEncounterManagerImpl(Y7lMIou0000WEN): remember streamPair: StreamPair (no ID)
2024-09-18 12:39:08.406 10992-11060 System.out net.sharksystem.asap.android I ASAPEncounterManagerImpl(Y7lMIou0000WEN): going to launch a new asap connection
2024-09-18 12:39:08.407 10992-11060 System.out net.sharksystem.asap.android I ASAPEncounterManagerImpl(Y7lMIou0000WEN): call asap peer to handle connection
2024-09-18 12:39:08.408 10992-11060 System.out net.sharksystem.asap.android I ASAPPersistentConnection(constructor): is: SocketInputStream | os: SocketOutputStream
2024-09-18 12:39:08.408 10992-11060 System.out net.sharksystem.asap.android I ASAPInternalPeerFS(Y7lMIou0000WEN): handleConnection
2024-09-18 12:39:08.408 10992-11060 System.out net.sharksystem.asap.android I ASAPInternalPeerFS(Y7lMIou0000WEN): announce new era
2024-09-18 12:39:08.409 10992-11060 System.out net.sharksystem.asap.android I ASAPEngineFS(owner: Y7lMIou0000WEN | oldestEra: 0 | era: 0 | routing: true): content not changed - era not changed
2024-09-18 12:39:08.410 10992-11060 System.out net.sharksystem.asap.android I ASAPInternalPeerFS(Y7lMIou0000WEN): launched new asapConnection thread, total number is now: 1
2024-09-18 12:39:08.416 10992-11061 System.out net.sharksystem.asap.android I ASAPInternalPeerFS(Y7lMIou0000WEN): start sending interest for apps/formats
2024-09-18 12:39:08.418 10992-11061 System.out net.sharksystem.asap.android I ASAPEngineFS(owner: Y7lMIou0000WEN | oldestEra: 0 | era: 0 | routing: true): send interest for app/format: ASAP_EXAMPLE_APP
2024-09-18 12:39:08.418 10992-11061 System.out net.sharksystem.asap.android I ASAPEngineFS(owner: Y7lMIou0000WEN | oldestEra: 0 | era: 0 | routing: true): send encounterMap with interest: {}
2024-09-18 12:39:08.443 10992-11061 System.out net.sharksystem.asap.android I ASAPPersistentConnection(to: unknown yet): start reading
2024-09-18 12:39:08.591 10992-11062 em.asap.android net.sharksystem.asap.android W Throwing OutOfMemoryError "Failed to allocate a 1145123856 byte allocation with 3166270 free bytes and 188MB until OOM, target footprint 6398078, growth limit 201326592" (VmSize 16391008 kB)
2024-09-18 12:39:08.595 10992-11061 System.out net.sharksystem.asap.android I ASAPPersistentConnection(to: unknown yet): back from reading
2024-09-18 12:39:08.595 10992-11061 System.out net.sharksystem.asap.android I ASAPPersistentConnection(to: unknown yet): start reading
2024-09-18 12:39:08.595 10992-11062 AndroidRuntime net.sharksystem.asap.android E FATAL EXCEPTION: Thread-4
Process: net.sharksystem.asap.android, PID: 10992
java.lang.OutOfMemoryError: Failed to allocate a 1145123856 byte allocation with 3166270 free bytes and 188MB until OOM, target footprint 6398078, growth limit 201326592
at net.sharksystem.asap.utils.ASAPSerialization.readCharSequenceParameter(ASAPSerialization.java:282)
at net.sharksystem.asap.protocol.PDU_Impl.readFormat(PDU_Impl.java:195)
at net.sharksystem.asap.protocol.InterestPDU_Impl.<init>(InterestPDU_Impl.java:24)
at net.sharksystem.asap.protocol.ASAP_Modem_Impl.readPDU(ASAP_Modem_Impl.java:251)
at net.sharksystem.asap.protocol.ASAPPersistentConnection$ASAPPDUReader.run(ASAPPersistentConnection.java:498)
2024-09-18 12:39:08.614 623-2062 ActivityTaskManager system_server W Force finishing activity net.sharksystem.asap.android/.example.ASAPExampleTCPEncounterActivity
This could be a hint for a memory leak.