fix: join node thread on stop; skip Phy close handlers in dtor - #294
Open
brukberhane wants to merge 1 commit into
Open
brukberhane wants to merge 1 commit into
brukberhane wants to merge 1 commit into
Conversation
zts_node_stop returned before _runNodeService deleted NodeService. ~Phy then called phyOnTcpClose after _tcpConnections_m was destroyed (FORTIFY SIGABRT on PROXY→VPN). Join the service pthread; close leftover sockets without handlers via a ZeroTierOne patch. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Summary
zts_node_stop/zts_node_freereturned before_runNodeServicefinisheddelete zts_service, so a second ZeroTier node (Android VPN JNI) could start while libzt was still tearing down the same identity.~Phy()calledclose(..., true)→phyOnTcpCloseafterNodeServicemembers such as_tcpConnections_mwere already destroyed → FORTIFYpthread_mutex_lock called on a destroyed mutex(SIGABRT on PROXY→VPN).Changes
pthread_tandpthread_joinit afterterminate()(lock dropped first so the service thread can takeservice_m).~PhyusescallHandlers=false) applied frombuild.sh, because that destructor lives in the nested submodule.Seen in ZerotierB exclusive stack swap: libzt PROXY → JNI VPN.
Test plan
zts_node_start→ traffic →zts_node_stop→zts_node_startwithout SIGABRTlibzt-node/_runNodeService./build.sh android-aar releaseappliespatches/zerotierone/0001-phy-dtor-skip-close-handlers.patchon a clean ZeroTierOne checkoutMade with Cursor