PtokaX > Bugs

Unsafe code in signal handler (linux version)


I'm now trying to make my hub working on new PtokaX 0.500, and I noticed some potential problems in source code (at least in UNIX part).

It's a known fact that signal handlers are restricted by set of calls that are safe inside them (referring to ).
In particular, malloc and pthread_mutex_lock are cannot be done in signal handlers.

But in current code there are two problems:
1) std::string is used in first line of SigHandler function (which implies use of malloc() ),
2) adding SHUTDOWN event to queue is of course wrapped by mutex, and this is unsafe too.

This may lead to deadlocks, coredumps on terminating process, etc.

I've noticed this because of another problem, which is under my investigation now: PtokaX freezes after running again on converted users base, but I had not found why.

Thank you for report, it will be fixed in next release  ;)


[0] Message Index

Go to full version