Skip to content

Getting TCP Client Receives a Non-Integer #145

Closed
@dalabarge

Description

@dalabarge

Getting TCP Client Receives a Non-Integer

I'm getting a significant in uptick of ANRs relating to getTcpClient(cid) where cid is not an integer:

java.lang.IllegalArgumentException: 
  at com.asterinet.react.tcpsocket.TcpSocketModule.getTcpClient (TcpSocketModule.java:251)
  at com.asterinet.react.tcpsocket.TcpSocketModule.access$700 (TcpSocketModule.java:28)
  at com.asterinet.react.tcpsocket.TcpSocketModule$2.run (TcpSocketModule.java:106)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
  at java.lang.Thread.run (Thread.java:923)

Current behavior

It appears that the cid passed to getTcpClient() in TcpSocketModule.java when calling end() is not an integer. The JS side internally manages the _id and therefore at some point the _id is a non-integer triggering an exception when this package passes the _id to the end() or destroy() method as a cid. Seems to be occuring since upgrading from 4.x to 5.x

Expected behavior

Only way for that to happen is for the JS to lose a reference or reset the internal _id reference and pass it over the bridge. The bridge should protect against such errant calls as a noop to avoid the crash.

Relevant information

OS Android 10-12
react-native 0.66.4
react-native-tcp-socket 5.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreleased

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions