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.
Currently,
Net::SSH2lacks support for being used in multi-threaded applications.The most prominent issue being that the handling of
Net::SSH2objects 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 callsDESTROYin 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.