Skip to content
This repository was archived by the owner on Sep 1, 2022. It is now read-only.
This repository was archived by the owner on Sep 1, 2022. It is now read-only.

LinkContext shutdown datarace  #396

@neilstephens

Description

@neilstephens

I was able to pinpoint a crash (seg fault) that I was experiencing on shutdown of DNP3 manager occasionally on 3.0.4.
I was seeing the issue in one of my integration tests for opendatacon where I test the link keepalive callbacks. I am using short interval keepalives and response timeouts which exacerbated the issue.

The problem is that the link keepalive and response timers on LinkContext could have outstanding handlers at the time of shutdown. Most of the time this is OK, because the handlers get cancelled on OnLowerLayerDown() and usually execute with operation aborted error code.

But in the case where a timer handler is already queued for execution when OnLowerLayerDown() is called, it executes with a success error code and goes on to access LinkContext members which are in the process of being destroyed.

I submitted a pull request with a fix. There is probably a better way to fix it, but it illustrates the issue and is good enough for me to use in the mean time to your upstream fix.

Cheers,
Neil.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions