Rapsssito / react-native-tcp-socket

React Native TCP socket API for Android, iOS & macOS with SSL/TLS support.
MIT License
303 stars 81 forks source link

App Crash On Socket Read and Write #196

Open wilhemknight opened 2 weeks ago

wilhemknight commented 2 weeks ago

Description

The Application always cause a crash every time I write a large amount of data to the socket I tried it on multiple devices, i observed that the larger the memory size of the device the more data can be read and written. My best guess is that some data artifacts remain on the devices memory even after the socket is destroyed

My Code Looks Something Like This:


     Server >>
      socket.on("data", function (dataBuffer) {

          //Data is processed and saved to a file
         //       About 2800 Lines Of Code
        // Then Socket Is ended and destroyed after this data chuck is processed
       // Each Data chunk is read as an object  file i.e "{" is start and "}" is end

      })

   Client >>
   Seperate Physical Device
    //Generates Data and writes to server after socket is destroyed then a new chunk of data is sent 
    // With each (1024 * 976) byte chunk the socket writes then (AWAITS for write to end and) sends a new (1024 * 976) byte chunk
     /** I EVENT TRIED A 10 SECOND TIMEOUT AFTER EACH CHUNK WRITE TO SEE IF IT WAS FROM THE CLIENT**/
    // On a 1gb ram device about (1024 * 976) * 57 byte chunks of data can be sent to the server before it crashes
    // On a 4gb ram device about (1024 * 976) * 200+ byte chunks of data can be sent to server before it crashes  

I tried editing some of the methods in the Socket.js file in the node_modules/react-native-tcp-socket folder to see if i could clear memory on each write not sure what i was doing half the time but nothing seemed to work

Relevant information

OS ios/android
react-native 0.63.5
react-native-tcp-socket 6.0.6