Menu

#570 opal deadlock mutex

Development_Branch
open
nobody
mutex lock (1)
5
2022-01-03
2017-07-30
No

Freeswitch mod_opal not lock mutex.

=========================================================

2017-07-30 11:18:18.518274 [CONSOLE] mod_opal.cpp:104 Starting loading mod_opal
0:15.002 mod_opal:12447 osutils.cxx(3873) PTLib Assertion fail: Possible deadlock in read/write mutex 0x1650ca0 (manager.h(2136),15000ms) :
thread-id=3052415360 (0xb5f02980), unique-id=12447, readers=0, writers=1
/usr/lib/libpt.so.2.17-alpha4(PPlatformWalkStack(std::ostream&, unsigned long, int, unsigned int)+0x101) [0xb4265b21]
/usr/lib/libpt.so.2.17-alpha4(PTrace::WalkStack(std::ostream&, unsigned long, int)+0x47) [0xb42884a7]
/usr/lib/libpt.so.2.17-alpha4(PReadWriteMutex::InternalWait(PReadWriteMutex::Nest&, PSync&, PDebugLocation const&) const+0x447) [0xb424fb97]
/usr/lib/libpt.so.2.17-alpha4(PReadWriteMutex::InternalStartWriteWithNest(PReadWriteMutex::Nest&, PDebugLocation const&)+0xa5) [0xb4250075]
/usr/lib/libpt.so.2.17-alpha4(PReadWriteMutex::InternalStartWrite(PDebugLocation const)+0x7e) [0xb42500fe]
/usr/lib/libopal.so.3.17-alpha5(OpalManager::AttachEndPoint(OpalEndPoint
, PString const&)+0x89) [0xb474c849]
/usr/lib/libopal.so.3.17-alpha5(OpalEndPoint::OpalEndPoint(OpalManager&, PCaselessString const&, PBitwiseEnum<OpalEndPoint::Attributes_Bits, (OpalEndPoint::Attributes_Bits)2,="" unsigned="" int="">)+0x282) [0xb4766b02]
/usr/lib/libopal.so.3.17-alpha5(OpalRTPEndPoint::OpalRTPEndPoint(OpalManager&, PCaselessString const&, PBitwiseEnum<OpalEndPoint::Attributes_Bits, (OpalEndPoint::Attributes_Bits)2,="" unsigned="" int="">)+0x47) [0xb483ad77]
/usr/lib/libopal.so.3.17-alpha5(H323EndPoint::H323EndPoint(OpalManager&)+0x6b) [0xb4bcf25b]
/usr/lib/freeswitch/mod/mod_opal.so(+0x14d1f) [0xb5716d1f]
/usr/lib/freeswitch/mod/mod_opal.so(+0x1a14d) [0xb571c14d]
/usr/lib/freeswitch/mod/mod_opal.so(+0x1a248) [0xb571c248]
/usr/lib/libfreeswitch.so.1(+0xc1657) [0xb724d657]
/usr/lib/libfreeswitch.so.1(switch_loadable_module_init
/usr/lib/libfreeswitch.so.1(switch_core_init_and_modload
freeswitch(+0x262e) [0x4a862e]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main
freeswitch(+0x3b17) [0x4a9b17]

Discussion

  • Robert Jongbloed

    Can you provide a full log file?

     
  • inderaputra

    inderaputra - 2022-01-03

    Hi, sorry for the necro, just that I also got the same error:

      0:15.033                RegTest:18067      osutils.cxx(4322)  PTLib           Assertion fail: 
    Possible deadlock in read/write mutex 0xbfa73188 (manager.h(2139),15000ms) :                    
      thread-id=3072149248 (0xb71d4700), unique-id=18067, readers=0, writers=1                      
            /mnt/vda1/OpalVOIP/libptlib-2.18.7/lib/libpt.so.2.18-beta8(PPlatformWalkStack(std::ostream&, unsigned long, int, unsigned int, bool)+0xe5) [0xb79ac065]                                 
            /mnt/vda1/OpalVOIP/libptlib-2.18.7/lib/libpt.so.2.18-beta8(PTrace::WalkStack(std::ostream&, unsigned long, int, bool)+0x55) [0xb79c95d5]                                              
            /mnt/vda1/OpalVOIP/libptlib-2.18.7/lib/libpt.so.2.18-beta8(PReadWriteMutex::InternalWait(PReadWriteMutex::Nest&, PSync&, PDebugLocation const&) const+0x429) [0xb7992089]             
            /mnt/vda1/OpalVOIP/libptlib-2.18.7/lib/libpt.so.2.18-beta8(PReadWriteMutex::InternalStartWriteWithNest(PReadWriteMutex::Nest&, PDebugLocation const&)+0xa5) [0xb7992555]                
            /mnt/vda1/OpalVOIP/libptlib-2.18.7/lib/libpt.so.2.18-beta8(PReadWriteMutex::InternalStartWrite(PDebugLocation const*)+0x69) [0xb79925c9]                                                
            /mnt/vda1/OpalVOIP/libopal-3.18.7/lib/libopal.so.3.18-beta8(OpalManager::AttachEndPoint(OpalEndPoint*, PString const&)+0x93) [0xb7c00773]                                               
            /mnt/vda1/OpalVOIP/libopal-3.18.7/lib/libopal.so.3.18-beta8(OpalEndPoint::OpalEndPoint(OpalManager&, PCaselessString const&, PBitwiseEnum<OpalEndPoint::Attributes_Bits, (OpalEndPoint::Attributes_Bits)2, unsigned int>)+0x2ac) [0xb7c16f4c]                                           
            /mnt/vda1/OpalVOIP/libopal-3.18.7/lib/libopal.so.3.18-beta8(OpalRTPEndPoint::OpalRTPEndPoint(OpalManager&, PCaselessString const&, PBitwiseEnum<OpalEndPoint::Attributes_Bits, (OpalEndPoint::Attributes_Bits)2, unsigned int>)+0x47) [0xb7cdf847]                                      
            /mnt/vda1/OpalVOIP/libopal-3.18.7/lib/libopal.so.3.18-beta8(OpalSDPEndPoint::OpalSDPEndPoint(OpalManager&, PCaselessString const&, PBitwiseEnum<OpalEndPoint::Attributes_Bits, (OpalEndPoint::Attributes_Bits)2, unsigned int>)+0x44) [0xb7d64bf4]                                      
            /mnt/vda1/OpalVOIP/libopal-3.18.7/lib/libopal.so.3.18-beta8(SIPEndPoint::SIPEndPoint(OpalManager&, unsigned int)+0x59) [0xb7da6b19]                                                     
            ./regtest(RegTest::Main()+0x15e) [0x8052cae] /mnt/vda1/OpalVOIP/test/main.cxx:50        
            /mnt/vda1/OpalVOIP/libptlib-2.18.7/lib/libpt.so.2.18-beta8(PProcess::InternalMain(void*)+0x65) [0xb798d905]                                                                             
            ./regtest(main /mnt/vda1/OpalVOIP/test/main.cxx:74                                      
            /lib/libc.so.6(__libc_start_main                                                        
            ./regtest(_start
    

    My compile configuration:

    • PTLib
    ./configure --prefix=/mnt/vda1/OpalVOIP/libptlib-2.18.7 --disable-snmp --disable-v8 --disable-vcard --disable-jabber --disable-xmlrpc --disable-soap --disable-ftp --disable-snmp --disable-telnet --disable-pop3smtp  --disable-curses --disable-odbc
    
    • OPAL
    ./configure --prefix=/mnt/vda1/OpalVOIP/libopal-3.18.7 --disable-srtp --disable-zrtp  --disable-speexdsp --disable-java --disable-csharp --disable-ruby --disable-h323 --disable-iax2 --disable-skinny --disable-h224 --disable-h281 --disable-t38 --disable-presence --disable-msrp --disable-fax --disable-h450 --disable-h460 --disable-h460nat --disable-perfhack --disable-plugins --with-ptlib=/mnt/vda1/OpalVOIP/libptlib-2.18.7/lib/pkgconfig
    
    • for test code, use files in opal-3.18.7/samples/test/sipreg folder.

    OS used are Ubuntu 16.04 32-bit, Ubuntu 18 64-bit (cross-compiled to 32-bit), and TinyCore 12 32-bit (all are 32-bit applications as we'll be using it on 32-bit platform). Same problem also appears when using PTLib v2.18.5.

    The program will stuck at when we're creating new SIPEndPoint object, which in turn registers it to OpalManager object. It seems that the problem is on using sem_timedwait() function, automatically enabled by P_HAS_SEMAPHORES_XPG6 flag when configuring PTLib. If I undef the flag (found in ptlib-2.18.7/include/ptlib_config.h) before compiling the library, the problem disappears.

     

    Last edit: inderaputra 2022-01-03

Log in to post a comment.