I suppose that there is BUG in p7zip for
CriticalSection_Init() function
p7zip uses mutex with PTHREAD_MUTEX_ERRORCHECK
pthread_mutexattr_settype(&mutexattr,PTHREAD_MUTEX_ERRORCHECK);
probably p7zip must use PTHREAD_MUTEX_RECURSIVE instead:
PTHREAD_MUTEX_RECURSIVE
A thread attempting to relock this mutex without first unlocking it will succeed in locking the mutex. The relocking deadlock which can occur with mutexes of type PTHREAD_MUTEX_NORMAL cannot occur with this type of mutex. Multiple locks of this mutex require the same number of unlocks to release the mutex before another thread can acquire the mutex. A thread attempting to unlock a mutex which another thread has locked will return with an error. A thread attempting to unlock an unlocked mutex will return with an error.
How to create test case for p7zip 16.02 and previous versions.
Call
7z a a.zip /Files -mmt4
for many files, and delete or rename some file during operation.
7-Zip calls EnterCriticalSection() twice in that case and some deadlock in p7zip is possible:
EnterCriticalSection()
EnterCriticalSection()
LeaveCriticalSection()
LeaveCriticalSection()