Coder Social home page Coder Social logo

willamowius / ptlib Goto Github PK

View Code? Open in Web Editor NEW
20.0 5.0 23.0 5.43 MB

PTLib 2.10.9 fork for GNU Gatekeeper and H323Plus

Home Page: https:/www.gnugk.org

Makefile 1.17% M4 1.20% C++ 89.00% C 6.25% Batchfile 0.04% Shell 0.19% HTML 0.32% Yacc 1.18% Roff 0.42% Lex 0.21%
communication h323 h323plus videoconferencing voip c-plus-plus video-conferencing

ptlib's Introduction

PTLib

This is a fork of PTLib 2.10.9 to keep a stable API for the H323Plus library and the GNU Gatekeeper. The main PTLib development branch makes substantial API changes with evrey version, while this branch keeps the API stable and only makes compatible changes wherever possible.

This fork is actively maintained to fix bugs and security issues.

License: MPL

H323Plus: https://www.h323plus.org

GNU Gatekeeper: https://www.gnugk.org

Support: https://www.willamowius.com

ptlib's People

Contributors

brad0 avatar bwalden avatar dkochmashev avatar gjasny avatar lastique avatar willamowius avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ptlib's Issues

compile whith GCC 8.4.0

ptlib/unix/ptlib/pmachdep.h:56:13: error: conflicting declaration 'typedef int socklen_t'
bits/alltypes.h:394:18: note: previous declaration as 'typedef unsigned int socklen_t' typedef unsigned socklen_t;

How about a new release

Hello Jan,

it's over a year now since the last release and some important portability fixes have been merges since then.

Would you please be so kind to release a new version?

Thanks,
Gregor

H323ListenerTCP::Close() hangs until timeout

We have an application that uses libh323plus to implement H323 signalling. When that application is shutting down, we are seeing that it hangs for about 10 seconds in H323ListenerTCP::Close(), after which it aborts with an error "Listener thread did not terminate".

This only reproduces on a Kubuntu 21.10 x86_64 machine. It does not reproduce on other machines running Debian 10 or 11. It also did not reproduce previously on the same machine when it was running Kubuntu 21.04. So it looks like this issue is triggered by something that comes with Kubuntu 21.10.

I have prepared a reduced test case that reproduced the issue on Kubuntu 21.10.

h323_hang_test.tar.gz

The test case just creates a H323ListenerTCP object with a single listener and waits for a keypress. Press Enter and it will attempt to terminate the listener and hang for 10 seconds, after which it will abort with the aforementioned error.

I have tried running the test under gdb and I can see that the code is waiting for the connection listening thread to terminate. I can see in gdb output that the thread actually terminates (gdb prints "[Thread 0x7ffff4f3d640 (LWP 133542) exited]" as soon as you press Enter), but the wait does not end until timeout. On timeout the process aborts with the following backtrace:

      assert.cxx(114)   PWLib   Assertion fail: Listener thread did not terminate, file transports.cxx, line 1321, Error=20
Assertion fail: Listener thread did not terminate, file transports.cxx, line 1321, Error=20

Dumping core.

Thread 1 "h323_hang_test" received signal SIGABRT, Aborted.
__pthread_kill_implementation (no_tid=0, signo=6, threadid=140737303301760) at pthread_kill.c:44
44      pthread_kill.c: No such file or directory.
(gdb) thread apply all bt

Thread 2 (Thread 0x7ffff4f7e640 (LWP 133541) "h323_hang_test"):
#0  __futex_abstimed_wait_common64 (private=0, cancel=true, abstime=0x0, op=393, expected=0, futex_word=0x555555673090) at futex-internal.c:57
#1  __futex_abstimed_wait_common (cancel=true, private=0, abstime=0x0, clockid=0, expected=0, futex_word=0x555555673090) at futex-internal.c:87
#2  __GI___futex_abstimed_wait_cancelable64 (futex_word=futex_word@entry=0x555555673090, expected=expected@entry=0, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=private@entry=0) at futex-internal.c:139
#3  0x00007ffff6b8b920 in __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x555555673040, cond=0x555555673068) at pthread_cond_wait.c:504
#4  ___pthread_cond_wait (cond=0x555555673068, mutex=0x555555673040) at pthread_cond_wait.c:628
#5  0x00007ffff73c2507 in PSyncPoint::Wait (this=0x555555673028) at ptlib/unix/tlibthrd.cxx:1719
#6  0x00007ffff7c04330 in H323ConnectionsCleaner::Main (this=0x555555672f20) at /home/lastique/src/xcoder/master/external/libh323plus/h323plus/src/h323ep.cxx:661
#7  0x00007ffff73bf3dd in PThread::PX_ThreadStart (arg=0x555555672f20) at ptlib/unix/tlibthrd.cxx:495
#8  0x00007ffff6b8c927 in start_thread (arg=<optimized out>) at pthread_create.c:435
#9  0x00007ffff6c1c9e4 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:100

Thread 1 (Thread 0x7ffff4f84e80 (LWP 133537) "h323_hang_test"):
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=140737303301760) at pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=140737303301760) at pthread_kill.c:80
#2  __GI___pthread_kill (threadid=140737303301760, signo=signo@entry=6) at pthread_kill.c:91
#3  0x00007ffff6b3a476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007ffff6b207b7 in __GI_abort () at abort.c:79
#5  0x00007ffff73f4809 in PAssertAction (c=67, msg=0x55555566f950 "Assertion fail: Listener thread did not terminate, file transports.cxx, line 1321, Error=20") at ptlib/unix/assert.cxx:81
#6  0x00007ffff73f4a21 in PAssertFunc (msg=0x55555566f950 "Assertion fail: Listener thread did not terminate, file transports.cxx, line 1321, Error=20") at ptlib/unix/assert.cxx:164
#7  0x00007ffff7440759 in PAssertFunc (file=0x7ffff7d6c35b "transports.cxx", line=1321, className=0x0, msg=0x7ffff7dae3b8 "Listener thread did not terminate") at ptlib/common/object.cxx:147
#8  0x00007ffff7bd90e4 in PAssertFuncInline (b=false, file=0x7ffff7d6c35b "transports.cxx", line=1321, className=0x0, msg=0x7ffff7dae3b8 "Listener thread did not terminate") at /home/lastique/xcoder-usr/include/ptlib/object.h:182
#9  0x00007ffff7c59d17 in H323ListenerTCP::Close (this=0x555555673260) at /home/lastique/src/xcoder/master/external/libh323plus/h323plus/src/transports.cxx:1321
#10 0x0000555555564b3b in endpoint::terminate() ()
#11 0x0000555555563a9a in main ()

I'm using ptlib 2.10.9.4 and libh323plus 1.27.2, both with minor patches updating build system and code for compatibility with our system (some of them are based on the upstream commits made after the released library versions). I'm fairly certain that the patches are not the problem as they have been tested before and don't cause problems on Debian.

I'm not quite sure if the problem is in ptlib or libh323plus, but it looks like threading code is in ptlib, and that is likely where the problem lies, hence I'm reporting it to ptlib.

Inconsistent definitions of `operator new[]`/`operator delete[]`

In commit 8772876, the signature of operator new[] has been changed to include std::align_val_t argument on a C++17 compiler. However, the signature of operator delete[] was not changed and remains without the std::align_val_t argument, which means it will not be called when the type of the object being deleted is over-aligned (i.e. when the overloaded operator new[] was called to allocate it).

Furthermore, the operator new[] does not use its std::align_val_t argument to ensure that the allocated memory is actually aligned to the value of std::align_val_t.

Relevant piece of code:

#if (__cplusplus >= 201703L) // C++17
void* operator new[](std::size_t nSize, std::align_val_t al) noexcept(false)
#else
#if (__GNUC__ >= 3) || ((__GNUC__ == 2)&&(__GNUC_MINOR__ >= 95)) //2.95.X & 3.X
void * operator new[](size_t nSize) throw ()
#else
void * operator new[](size_t nSize)
#endif
#endif
{
return malloc(nSize);
}
#if (__GNUC__ >= 3) || ((__GNUC__ == 2)&&(__GNUC_MINOR__ >= 95)) //2.95.X & 3.X
void operator delete[](void * ptr) throw ()
#else
void operator delete[](void * ptr)
#endif
{
free(ptr);
}

Either both operator new[] and operator delete[] should accept (and use) the std::align_val_t argument, or none should. Lastly, in order to use std::align_val_t, <new> must be included, and this include is missing in object.cxx.

Relevant documentation for memory allocation functions:

https://en.cppreference.com/w/cpp/memory/new/operator_new
https://en.cppreference.com/w/cpp/memory/new/operator_delete

Supporting OpenLDAP 2.5 or newer

Looking at PTLIB_FIND_OPENLDAP in ptlib.m4..

          if test "x${ptlib_openldap}" = "xyes"; then  
            case "$target_os" in
            solaris* | sunos* )
                            dnl posix4 is required by libldap_r on Solaris
                            ptlib_openldap_libs="-lposix4"
                            ;;
                            * )
                            ptlib_openldap_libs="-llber -lldap_r"
            esac

The macro hardcodes libldap_r for OpenLDAP. OpenLDAP 2.5 and newer has eliminated the libdap_r library and merged that into libldap. I'm not sure how you would want to deal with that. The OpenBSD port just has a diff to s/ldap_r/ldap/ but of course something better is necessary

make error

/u/l/s/ptlib-master# make
make DEBUG= P_SHAREDLIB=1 default_target
make[1]: вход в каталог «/usr/local/src/ptlib-master»
make[1]: выход из каталога «/usr/local/src/ptlib-master»
make[1]: вход в каталог «/usr/local/src/ptlib-master/src»
make DEBUG= P_SHAREDLIB=1 default_target
make[2]: вход в каталог «/usr/local/src/ptlib-master/src»
[CC] ptclib/psasl.cxx
[CC] ptclib/pldap.cxx
[CC] ptclib/pils.cxx
[CC] ptclib/pssl.cxx
ptclib/pssl.cxx:748:13: предупреждение: «void LockingCallback(int, int, const char*, int)» определена, но не используется [-Wunused-function]
static void LockingCallback(int mode, int n, const char * /file/, int /line/)
^~~~~~~~~~~~~~~
[CC] ptclib/podbc.cxx
In file included from /usr/include/sql.h:19,
from /usr/include/odbcinst.h:22,
from /usr/local/src/ptlib-master/include/ptclib/podbc.h:100,
from ptclib/podbc.cxx:39:
/usr/include/sqltypes.h:105:26: ошибка: конфликтующая декларация «typedef short unsigned int WCHAR»
typedef unsigned short WCHAR;
^~~~~
In file included from /usr/local/src/ptlib-master/include/ptlib/object.h:44,
from /usr/local/src/ptlib-master/include/ptlib/psync.h:43,
from /usr/local/src/ptlib-master/include/ptlib/critsec.h:34,
from /usr/local/src/ptlib-master/include/ptlib/contain.h:42,
from /usr/local/src/ptlib-master/include/ptlib.h:56,
from ptclib/podbc.cxx:35:
/usr/local/src/ptlib-master/include/ptlib/unix/ptlib/contain.h:96:33: замечание: предыдущая декларация «typedef wchar_t WCHAR»
typedef wchar_t WCHAR;
^~~~~
In file included from /usr/include/sql.h:19,
from /usr/include/odbcinst.h:22,
from /usr/local/src/ptlib-master/include/ptclib/podbc.h:100,
from ptclib/podbc.cxx:39:
/usr/include/sqltypes.h:272:33: ошибка: конфликтующая декларация «typedef unsigned int UINT»
typedef unsigned int UINT;
^~~~
In file included from /usr/local/src/ptlib-master/include/ptlib/object.h:44,
from /usr/local/src/ptlib-master/include/ptlib/psync.h:43,
from /usr/local/src/ptlib-master/include/ptlib/critsec.h:34,
from /usr/local/src/ptlib-master/include/ptlib/contain.h:42,
from /usr/local/src/ptlib-master/include/ptlib.h:56,
from ptclib/podbc.cxx:35:
/usr/local/src/ptlib-master/include/ptlib/unix/ptlib/contain.h:86:22: замечание: предыдущая декларация «typedef uintptr_t UINT»
typedef uintptr_t UINT;
^~~~
ptclib/podbc.cxx: В функции-члене «PString PODBC::Field::AsString()»:
ptclib/podbc.cxx:489:9: предупреждение: эта «if» клаузула не защищает... [-Wmisleading-indentation]
if (B)
^~
ptclib/podbc.cxx:491:11: замечание: ...этот оператор, но последний ошибочно полагается на защиту «if»
return Convert(b.sbint);
^~~~~~
ptclib/podbc.cxx:495:9: предупреждение: эта «if» клаузула не защищает... [-Wmisleading-indentation]
if (B)
^~
ptclib/podbc.cxx:497:11: замечание: ...этот оператор, но последний ошибочно полагается на защиту «if»
return Convert(b.sbit);
^~~~~~
ptclib/podbc.cxx:500:9: предупреждение: эта «if» клаузула не защищает... [-Wmisleading-indentation]
if (B)
^~
ptclib/podbc.cxx:502:11: замечание: ...этот оператор, но последний ошибочно полагается на защиту «if»
return Convert(b.suchar);
^~~~~~
ptclib/podbc.cxx:505:9: предупреждение: эта «if» клаузула не защищает... [-Wmisleading-indentation]
if (B)
^~
ptclib/podbc.cxx:507:11: замечание: ...этот оператор, но последний ошибочно полагается на защиту «if»
return Convert(b.slint);
^~~~~~
ptclib/podbc.cxx:510:9: предупреждение: эта «if» клаузула не защищает... [-Wmisleading-indentation]
if (B)
^~
ptclib/podbc.cxx:512:11: замечание: ...этот оператор, но последний ошибочно полагается на защиту «if»
return Convert(b.ssint);
^~~~~~
ptclib/podbc.cxx:519:9: предупреждение: эта «if» клаузула не защищает... [-Wmisleading-indentation]
if (B)
^~
ptclib/podbc.cxx:521:11: замечание: ...этот оператор, но последний ошибочно полагается на защиту «if»
return Convert(b.sdoub,Decimals);
^~~~~~
ptclib/podbc.cxx:525:9: предупреждение: эта «if» клаузула не защищает... [-Wmisleading-indentation]
if (B)
^~
ptclib/podbc.cxx:527:11: замечание: ...этот оператор, но последний ошибочно полагается на защиту «if»
return Convert(b.date);
^~~~~~
ptclib/podbc.cxx:530:9: предупреждение: эта «if» клаузула не защищает... [-Wmisleading-indentation]
if (B)
^~
ptclib/podbc.cxx:532:11: замечание: ...этот оператор, но последний ошибочно полагается на защиту «if»
return Convert(b.time);
^~~~~~
ptclib/podbc.cxx:535:10: предупреждение: эта «if» клаузула не защищает... [-Wmisleading-indentation]
if (B)
^~
ptclib/podbc.cxx:537:12: замечание: ...этот оператор, но последний ошибочно полагается на защиту «if»
return Convert(b.timestamp);
^~~~~~
ptclib/podbc.cxx:540:10: предупреждение: эта «if» клаузула не защищает... [-Wmisleading-indentation]
if (B)
^~
ptclib/podbc.cxx:542:12: замечание: ...этот оператор, но последний ошибочно полагается на защиту «if»
return Convert(b.guid);
^~~~~~
ptclib/podbc.cxx:556:9: предупреждение: эта «if» клаузула не защищает... [-Wmisleading-indentation]
if (B)
^~
ptclib/podbc.cxx:558:11: замечание: ...этот оператор, но последний ошибочно полагается на защиту «if»
return b.sbin;
^~~~~~
ptclib/podbc.cxx: В функции-члене «void PODBCRecord::Data(PINDEX, PODBC::Field&)»:
ptclib/podbc.cxx:1332:72: предупреждение: приведение к типу указателя от целого другого размера [-Wint-to-pointer-cast]
SQLBindCol(m_hStmt, Column, SQL_LONGVARCHAR, (SQLPOINTER)Column, 0, &b.dataLen);
^~~~~~
make[2]: *** [../make/common.mak:97: /usr/local/src/ptlib-master/lib_linux_x86_64/obj/podbc.o] Ошибка 1
make[2]: выход из каталога «/usr/local/src/ptlib-master/src»
make[1]: *** [../make/common.mak:292: optshared] Ошибка 2
make[1]: выход из каталога «/usr/local/src/ptlib-master/src»
make: *** [Makefile:91: optshared] Ошибка 2

CentOS 8 4.18.0-240.10.1.el8_3.x86_64

Multiple occurrences of same option letter

When I follow the README in plugins/sound_pulse to let the audio tool report the available
sound devices, then I get the following error:

# obj_linux_x86_64/audio -r
      assert.cxx(114)   PWLib   Assertion fail: Multiple occurrences of same option letter, file ptlib/common/osutils.cxx, line 1189, Error=20
Assertion fail: Multiple occurrences of same option letter, file ptlib/common/osutils.cxx, line 1189, Error=20

Dumping core.
Aborted (core dumped)

macOS compilation fix

Hi William! Got two issue around with macOS builds - just want share with you

  1. Removing old macros definition for higher OpenSSL version (MacOS mostly-didn't check it under linux compilation yet) - we got that macros defined in openssl library at least for macports version
diff --git a/src/ptclib/pssl.cxx b/src/ptclib/pssl.cxx
index 6ef2ecb..1a6cda7 100644
--- a/src/ptclib/pssl.cxx
+++ b/src/ptclib/pssl.cxx
@@ -670,7 +670,7 @@ PSSLDiffieHellman::~PSSLDiffieHellman()
     DH_free(dh);
 }
 
-#ifdef P_d2i_DHparams_bio_OLD
+#if defined(P_d2i_DHparams_bio_OLD) && OPENSSL_VERSION_NUMBER < 0x100020efL
 // 2/21/04 Yuri Kiryanov - fix for compiler choke on BeOS for usage of
 // SSL function d2i_DHparams_bio below in PSSLDiffieHellman::Load
 // 5/26/06 Hannes Friederich - Mac OS X seems to need that fix too...
  1. And the second one(oldest) pthread_yield is not here
diff --git a/src/ptlib/unix/tlibthrd.cxx b/src/ptlib/unix/tlibthrd.cxx
index 4a30dd0..8402cd7 100644
--- a/src/ptlib/unix/tlibthrd.cxx
+++ b/src/ptlib/unix/tlibthrd.cxx
@@ -1534,7 +1534,11 @@ PTimedMutex::~PTimedMutex()
     for (PINDEX i = 0; i < 100; ++i) {
       if ((result = pthread_mutex_destroy(&m_mutex)) != EBUSY)
         break;
+#ifdef __MACH__
+      sched_yield();
+#else
       pthread_yield();
+#endif
     }
   }

Also it's an issue with installing version.h file under macOS - but emacs ruined all tabs/spaces in Makefile.in so the diff it's just uninformative - will send a bit later

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.