Get the network address

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




[Please, sent also to me directly because I'm not yet in the mailing-list]

Hi all,

I'm trying to create a UDP sockets: a server and a client. This server and
this client are located on the same machine, and running at the same
application on different threads.

However, some problems arises that I don't understand completely. What
happen is that when I use the inet_addr or inet_aton to get the net address
from the ddd.ddd.ddd.ddd to the ASCII representation, it gives me a core
dump, and the application goes down (either using inet_addr or inet_aton).

This function is been used in the thread code. However, if I call this
function in the main function (I'm using global variables) this problem does
not happen, but when I do the last pthread_join (whatever the number of
threads I have) they give me also a core dump error. In this latter case,
the sockets work properly and the core dump are just on the end.
I'm using the gcc to compile with the -lpthread library and don't the
-lsocket (because are not present in my system).

Anybody knows what is missing or what I am doing wrong. Any tips are
welcome.
Thanks in advance.


Some information:

I'm using 2.4.4 kernel and RedHat7.1
The following are the gdm output after running the application and typing
'where'. The number of threads I'm using is 3 (a client, server and any
other just getting the time of day)

Calling the inet_addr/ inet_aton in the thread:

[root@hostB PPSLinux]# gdb ipprobe
GNU gdb 5.0rh-5 Red Hat Linux 7.1
Copyright 2001 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: /root/IPPROBE/PPSLinux/ipprobe
[New Thread 1024 (LWP 1279)]
[New Thread 2049 (LWP 1280)]
Delayed SIGSTOP caught for LWP 1280.
[New Thread 1026 (LWP 1281)]
Delayed SIGSTOP caught for LWP 1281.
Im receiver; my arg is 1015524832,143442
[New Thread 2051 (LWP 1282)]
Delayed SIGSTOP caught for LWP 1282.
Im sender; my arg is 1015524832,183168
1
Received Real-time signal 0 in LWP 1279 while waiting for SIGSTOP.
 
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 2051 (LWP 1282)]
0x4000d7a9 in fixup (l=0x40017400, reloc_offset=1040) at dl-runtime.c:59
59      dl-runtime.c: No such file or directory.
        in dl-runtime.c
(gdb) where
#0  0x4000d7a9 in fixup (l=0x40017400, reloc_offset=1040) at dl-runtime.c:59
#1  0x4000d9b0 in _dl_runtime_resolve () at dl-runtime.c:203
#2  0x08048d5d in create_send_UDP_socket ()
#3  0x08048fc3 in packet_sender ()
#4  0x4002abfd in pthread_start_thread (arg=0x41211c00) at manager.c:262
#5  0x4002acdf in pthread_start_thread_event (arg=0x41211c00) at
manager.c:285
(gdb)



Calling the inet_addr/inet_aton in the main:

[root@hostB PPSLinux]# gdb ipprobe
GNU gdb 5.0rh-5 Red Hat Linux 7.1
Copyright 2001 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: /root/IPPROBE/PPSLinux/ipprobe
[New Thread 1024 (LWP 1232)]
[New Thread 2049 (LWP 1233)]
Delayed SIGSTOP caught for LWP 1233.
[New Thread 1026 (LWP 1234)]
Delayed SIGSTOP caught for LWP 1234.
Im receiver; my arg is 1015524681,806723
[New Thread 2051 (LWP 1235)]
Delayed SIGSTOP caught for LWP 1235.
Im sender; my arg is 1015524681,846875
1
2
Im receiver; I've received:AAAA
Im sender; I send:AAAA
LWP 1235 exited.
LWP 1234 exited.
[New Thread 3076 (LWP 1236)]
Delayed SIGSTOP caught for LWP 1236.
Im db; my arg is 1015524681,887448
Received Real-time signal 0 in LWP 1232 while waiting for SIGSTOP.
 
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 3076 (LWP 1236)]
0x4000d7a9 in fixup (l=0x40017400, reloc_offset=2784) at dl-runtime.c:59
59      dl-runtime.c: No such file or directory.
        in dl-runtime.c
(gdb) where
#0  0x4000d7a9 in fixup (l=0x40017400, reloc_offset=2784) at dl-runtime.c:59
#1  0x4000d9b0 in _dl_runtime_resolve () at dl-runtime.c:203
#2  0x40163b77 in __getservbyname_r (name=0x4005464d "mysql",
    proto=0x40054649 "tcp", resbuf=0x40197af8, buffer=0x804c880 "",
    buflen=1024, result=0x41a11834) at ../nss/getXXbyYY_r.c:168
#3  0x4016396f in getservbyname (name=0x4005464d "mysql",
    proto=0x40054649 "tcp") at ../nss/getXXbyYY.c:131
#4  0x400413ad in mysql_once_init () from /usr/lib/libmysqlclient.so.10
#5  0x40043a14 in mysql_init () from /usr/lib/libmysqlclient.so.10
#6  0x08049149 in db_access ()
#7  0x4002abfd in pthread_start_thread (arg=0x41a11c00) at manager.c:262
#8  0x4002acdf in pthread_start_thread_event (arg=0x41a11c00) at
manager.c:285
(gdb)



Carlos Parada

**********
Carlos Fonseca Parada
Portugal Telecom INovação, S.A.
MSI - Multimédia e Serviços IP - Redes MultiServiço
*   Rua Engº José Ferreira Pinto Basto - 3810 Aveiro - Portugal
Tel   +351 234 403317		Ext: 1317
Fax  +351 234 420722



-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux