Re: [Openh323gk-developer] gnugk eats memory [PATCH]
H.323 Gatekeeper for VoIP and videconferencing
Brought to you by:
willamowius
From: Thomas J. <ad...@po...> - 2002-10-14 07:37:17
|
Hello, we found a bug in the pwlib code. Thanks to Alex, the problem source was identified: when the server has netmask not 0 at the end (e.g. 255.255.255.224), the pwlib fails. I searched the code and find the problem in the PIPSocket::GetRouteTable function (pwlib/src/ptlib/unix/socket.cxx) Simply: long net_addr, dest_addr, net_mask; is wrong, because these variables shoud have 31bit unsigned number while IP Addresses and netmasks has 32bit length. Therefore when I had e.g. .224 netmask, it shouldn be placed into this variable and it made a loop. The right way: unsigned long net_addr, dest_addr, net_mask; I tested it and now it works like a charm with any network netmask. Regards, Thomas patch: --- pwlib/src/ptlib/unix/socket.cxx.orig 2002-10-12 13:22:50.000000000 +0200 +++ pwlib/src/ptlib/unix/socket.cxx 2002-10-12 13:23:14.000000000 +0200 @@ -1030,7 +1030,7 @@ return TRUE; char iface[20]; - long net_addr, dest_addr, net_mask; + unsigned long net_addr, dest_addr, net_mask; int flags, refcnt, use, metric; procfile >> iface >> ::hex >> net_addr >> dest_addr >> flags >> ::dec >> refcnt >> use >> metric On Mon, 7 Oct 2002, Thomas Jalsovsky wrote: > > > > I have the same problem, that the gk loops into infinity > > > and eats up all mem in Toolkit::RouteTable::InitTable() > Yes, it looks like a BUG... > > > > > > > I use: gk-2.0a, openh323-1.9.9, pwlib-1.3.9, > > > kernel-2.4.19-gentoo1.4rc1, gcc3.2 > > > > > > I assume that the problem lies in the pwlib. > > > Note: This only happens if the netmask is > > > not 'even' (not on 8 bit boundaries) > > > I mean, eg: 255.255.255.248 > > Great! I changed the netmask a week ago and about that time gnugk won't > > start. So probably there is something wrong around networking. > > But, I had the same problem on that NAT firewall when I had > > netmasks: 255.255.255.0. > > > > > > > > As a workaround, to get it running i return just after > > > PIPSocket::GetHostAddress(defAddr); > I'm looking for the code, but unfortunately I'm not a C++ expert :-( > Did you try to make the return point not directly after the mentioned line > but above? > > > > But i dont know what sideeffects this can cause, > > > anyhow it runs now in our test environment. > > I will try it, too. > I tryed. You are right. When I use something not 'even' netmasks it eats > the memory and if I have e.g. /24 it works fine. > Unfortunately I have to use /29, so I need to solve this problem.... > > Regards, > Thomas > > > Unfortunately developers didn't answer for my question :(( > > > > Regards, > > Thomas > > > > > Cheers > > > Alex > > > > > > > > > > > > On Fri, 2002-09-27 at 16:02, Thomas Jalsovsky wrote: > > > > > > > > > > > > Hello, > > > > gnugk-2.0a compiled with today's pwlib & openh323 libraries (CVS) > > > > does not start on RedHat Linux 7.3, kernel-2.4.20-pre7-ac3, > > > > glibc-2.2.90-26 (Rawhide), gcc-3.2-0.3 (compiled with). > > > > > > > > [root@fw-lan OK-debug]# gdb gnugk > > > > GNU gdb Red Hat Linux (5.2-2) > > > > Copyright 2002 Free Software Foundation, Inc. > > > > GDB is free software, covered by the GNU General Public License, and you > > > > are > > > > welcome to change it and/or distribute copies of it under certain > > > > conditions. > > > > Type "show copying" to see the conditions. > > > > There is absolutely no warranty for GDB. Type "show warranty" for > > > > details. > > > > This GDB was configured as "i386-redhat-linux"... > > > > (gdb) run > > > > Starting program: /DEVEL/OK-debug/gnugk > > > > [New Thread 1024 (LWP 9249)] > > > > [New Thread 2049 (LWP 9257)] > > > > [New Thread 1026 (LWP 9258)] > > > > > > > > Program received signal SIGINT, Interrupt. > > > > [Switching to Thread 1026 (LWP 9258)] > > > > 0x402cf281 in nanosleep () from /lib/libc.so.6 > > > > (gdb) Quit > > > > (gdb) bt > > > > #0 0x402cf281 in nanosleep () from /lib/libc.so.6 > > > > #1 0x40024e8d in __pthread_timedsuspend_new () from /lib/libpthread.so.0 > > > > #2 0x400223e8 in pthread_cond_timedwait_relative () from > > > > /lib/libpthread.so.0 > > > > #3 0x40022108 in pthread_cond_timedwait () from /lib/libpthread.so.0 > > > > #4 0x0838995f in PSyncPoint::Wait(PTimeInterval const&) (this=0x85196b0, > > > > waitTime=@0xbf7ffa3c) at tlibthrd.cxx:1342 > > > > #5 0x08361c4a in PXConfigWriteThread::Main() (this=0x851ae20) at > > > > config.cxx:218 > > > > #6 0x08388425 in PThread::PX_ThreadStart(void*) (arg=0x851ae20) at > > > > tlibthrd.cxx:873 > > > > #7 0x4002371a in pthread_start_thread () from /lib/libpthread.so.0 > > > > #8 0x40023789 in pthread_start_thread_event () from /lib/libpthread.so.0 > > > > (gdb) Quit > > > > (gdb) > > > > > > > > or: > > > > strace gnugk > > > > ... > > > > mprotect(0x4034e000, 1252, PROT_NONE) = 0 > > > > old_mmap(0x4034e000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, > > > > 11, 0x8000) = 0x4034e000 > > > > close(11) = 0 > > > > munmap(0x40012000, 26251) = 0 > > > > open("/etc/host.conf", O_RDONLY) = 11 > > > > fstat64(11, {st_mode=S_IFREG|0644, st_size=29, ...}) = 0 > > > > mmap2(NULL, 29, PROT_READ, MAP_SHARED, 11, 0) = 0x40012000 > > > > _llseek(11, 29, [29], SEEK_SET) = 0 > > > > fstat64(11, {st_mode=S_IFREG|0644, st_size=29, ...}) = 0 > > > > munmap(0x40012000, 29) = 0 > > > > close(11) = 0 > > > > open("/etc/hosts", O_RDONLY) = 11 > > > > fcntl64(11, F_GETFD) = 0 > > > > fcntl64(11, F_SETFD, FD_CLOEXEC) = 0 > > > > fstat64(11, {st_mode=S_IFREG|0644, st_size=1161, ...}) = 0 > > > > mmap2(NULL, 1161, PROT_READ, MAP_SHARED, 11, 0) = 0x40012000 > > > > _llseek(11, 1161, [1161], SEEK_SET) = 0 > > > > munmap(0x40012000, 1161) = 0 > > > > close(11) = 0 > > > > gettimeofday({1033135232, 629006}, NULL) = 0 > > > > socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 11 > > > > ioctl(11, 0x5421, [1]) = 0 > > > > fcntl64(11, F_SETFD, FD_CLOEXEC) = 0 > > > > brk(0x8525000) = 0x8525000 > > > > ioctl(11, 0x8912, 0xbffff3a8) = 0 > > > > ioctl(11, 0x8913, 0xbffff380) = 0 > > > > ioctl(11, 0x8927, 0xbffff380) = 0 > > > > brk(0x8526000) = 0x8526000 > > > > ioctl(11, 0x8915, 0xbffff380) = 0 > > > > ioctl(11, 0x891b, 0xbffff380) = 0 > > > > ioctl(11, 0x8913, 0xbffff380) = 0 > > > > ioctl(11, 0x8927, 0xbffff380) = 0 > > > > ioctl(11, 0x8915, 0xbffff380) = 0 > > > > ioctl(11, 0x891b, 0xbffff380) = 0 > > > > ioctl(11, 0x8913, 0xbffff380) = 0 > > > > ioctl(11, 0x8927, 0xbffff380) = 0 > > > > ioctl(11, 0x8915, 0xbffff380) = 0 > > > > ioctl(11, 0x891b, 0xbffff380) = 0 > > > > shutdown(11, 2 /* send and receive */) = -1 ENOTCONN (Transport endpoint > > > > is not connected) > > > > close(11) = 0 > > > > open("/proc/net/route", O_RDONLY) = 11 > > > > fcntl64(11, F_SETFD, FD_CLOEXEC) = 0 > > > > read(11, "Iface\tDestination\tGateway \tFlags"..., 1024) = 640 > > > > brk(0x8527000) = 0x8527000 > > > > brk(0x8528000) = 0x8528000 > > > > brk(0x8529000) = 0x8529000 > > > > brk(0x852a000) = 0x852a000 > > > > brk(0x852b000) = 0x852b000 > > > > brk(0x852c000) = 0x852c000 > > > > brk(0x852d000) = 0x852d000 > > > > brk(0x852e000) = 0x852e000 > > > > brk(0x852f000) = 0x852f000 > > > > brk(0x8530000) = 0x8530000 > > > > ... > > > > only brk(x) = x lines while I don't kill the process. > > > > > > > > Any idea? I upgraded kernel, glibc, but it didn't help. The same > > > > compiled version runs well on another server with the same config (distro, > > > > glibc, gcc, kernel). > > > > > > > > Thanks, > > > > Thomas > > > > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > This sf.net email is sponsored by:ThinkGeek > > > > Welcome to geek heaven. > > > > http://thinkgeek.com/sf > > > > _______________________________________________ > > > > Openh323gk-developer mailing list > > > > Ope...@li... > > > > https://lists.sourceforge.net/lists/listinfo/openh323gk-developer > > > > > > > -- > > > Alexander Schupp > > > R&D > > > > > > ISI AG > > > Landstrasse 1 > > > FL-9490 Vaduz > > > > > > Phone +423 232 97 00 > > > Mobile +43 676 514 7797 > > > Fax +423 232 97 01 > > > Email as...@is... > > > Web www.isi-it.com > > > > > > ---------------------- > > > CONFIDENTIALITY NOTICE > > > This communication contains information which is confidential and may > > > also be privileged. It is for the exclusive use of the intended > > > recipient(s). > > > If you are not the intended recipient(s), please note that any > > > distribution, copying or use of this communication or the information > > > in it is strictly prohibited. If you have received this communication > > > in error, please notify us immediately by returned mail or > > > telephone number above and destroy the email and any copies of it. > > > > > > > > > > > > > > > ------------------------------------------------------- > > > This sf.net email is sponsored by:ThinkGeek > > > Welcome to geek heaven. > > > http://thinkgeek.com/sf > > > _______________________________________________ > > > Openh323gk-developer mailing list > > > Ope...@li... > > > https://lists.sourceforge.net/lists/listinfo/openh323gk-developer > > > > > > > > > > > ------------------------------------------------------- > > This sf.net email is sponsored by:ThinkGeek > > Welcome to geek heaven. > > http://thinkgeek.com/sf > > _______________________________________________ > > Openh323gk-developer mailing list > > Ope...@li... > > https://lists.sourceforge.net/lists/listinfo/openh323gk-developer > > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Openh323gk-developer mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/openh323gk-developer > |