Skip to content

Object lifetime in multi-threading applications #40

@salva

Description

@salva

Currently, Net::SSH2 lacks support for being used in multi-threaded applications.

The most prominent issue being that the handling of Net::SSH2 objects lifetime doesn't take into consideration that when using threads, the Perl side of the object wrappers may be cloned, while the C side they point to are not, and so, once some thread calls DESTROY in any object, the underlaying C structures become deallocated leaving the clones in the rest of the threads with a dangling pointer.

The following post at StackOverflow shows a practical case of that bug being triggered: Perl - How to make a library specific to individual threads.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions