Skip to content

DeleteNode() occurring during ProcessMessages() #23657

@rebroad

Description

@rebroad

I am having segmentation faults occurring due to the node being deleted while ProcessMessages() is still running. This only started occurring after I rebased from master including PR #21943. It appears that the previous functionality created an nRefCount via AddRef() that persisted until after running ProcessMessages() and SendMessages(), whereas it appears it is being released now prior to running ProcessMessages().

Debug.log:-

2021-12-02T19:58:44.778 SocketHandlerConnected: nBytes=0 recvSet=1 errorSet=0 Disconnect peer=56
2021-12-02T19:58:44.778 recv version: /Satoshi:22.0.0/ v=70016 s=409 relay=1 peeraddr=98.111.202.161:8333 peer=56
2021-12-02T19:58:44.779 DisconnectNodes: Add to m_nodes_disconnected m_nodes.size 11->10 GRC=1 peer=56
2021-12-02T19:58:44.779 DisconnectNodes: Calling DeleteNode GRC=0 from m_nodes_disconnected loop. peer=56
2021-12-02T19:58:44.779 send feefilter 0->1569 (actual: 1490) peer=56

it crashes upon calling UpdatePreferredDownload() while processing the version message, as State(pfrom.GetId()) no longer exists.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions