Repository navigation
fix: prevent NullPointerException in write() on Android due to TOCTOU race condition with destroy() (#233) - #234
Merged
Merged
Conversation
Removed HTML line breaks from the connectTimeout description for better readability.
…tion with destroy() (Rapsssito#233)
github-actions Bot
pushed a commit
that referenced
this pull request
Jul 26, 2026
## [6.4.2](v6.4.1...v6.4.2) (2026-07-26) ### Bug Fixes * **iOS:** emit error when onConnect hosts are nil ([#235](#235)) ([3d99c5f](3d99c5f)) * pass through all listen options to native, including tls ([#236](#236)) ([55bf524](55bf524)) * prevent NullPointerException in write() on Android due to TOCTOU race condition with destroy() ([#233](#233)) ([#234](#234)) ([f85d07d](f85d07d))
|
🎉 This PR is included in version 6.4.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
bardbess
added a commit
to bardbess/react-native-tcp-socket
that referenced
this pull request
Sep 8, 2026
…o#203) TcpSocketClient's constructor creates two Executors.newSingleThreadExecutor() and destroy() shut down neither. A single-thread executor keeps its core thread alive indefinitely, so every connection ever opened left two live threads and their stacks behind - the unbounded thread and memory growth reported in Rapsssito#203, where a server that closes each socket immediately still grows until the OS kills the process. shutdown() rather than shutdownNow(), so the receiver task ends on its own once the socket is closed and an already-accepted write still reaches the wire, and in a `finally` so it happens whether or not the close threw. write() now catches the RejectedExecutionException a shut-down executor throws and reports the same "Attempted to write to closed socket" it already reports for a null socket, rather than letting it reach the bridge uncaught. Caught rather than guarded with isShutdown(), which would reintroduce the check-then-act race fixed in Rapsssito#233/Rapsssito#234.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.