This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Memory leak in DM368 IPNC onvif code?

Hi,

   Recently I debug DM368 IPNC Ver3.0 source code.When I use the 3rd VMS to connect IPNC,boa process crash,and terminal output:

Alignment trap: boa (682) PC=0x003d43c4 Instr=0xe5933000 Address=0xffffffff FSR 0x001
[01/Jan/2000:04:03:18 +0000] caught SIGBUS, dumping core in /tmp

So I re-compile boa source code and define -DDEBUG, when I use the VMS to connect IPNC again,boa process does not crash,but terminal output:

onvif_src/stdsoap2.c(2142): malloc() = 0x520150 not freed (memory leak or forgot to call soap_end()?)
onvif_src/stdsoap2.c(7268): malloc() = 0x520178 not freed (memory leak or forgot to call soap_end()?)
onvif_src/stdsoap2.c(2164): malloc() = 0x5201a0 not freed (memory leak or forgot to call soap_end()?)
onvif_src/stdsoap2.c(8206): malloc() = 0x51f568 not freed (memory leak or forgot to call soap_end()?)
onvif_src/stdsoap2.c(8206): malloc() = 0x51f590 not freed (memory leak or forgot to call soap_end()?)
onvif_src/stdsoap2.c(8206): malloc() = 0x51f5b8 not freed (memory leak or forgot to call soap_end()?)
onvif_src/stdsoap2.c(7268): malloc() = 0x51f5e0 not freed (memory leak or forgot to call soap_end()?)
onvif_src/stdsoap2.c(7268): malloc() = 0x51f670 not freed (memory leak or forgot to call soap_end()?)
onvif_src/stdsoap2.c(7268): malloc() = 0x51f6a0 not freed (memory leak or forgot to call soap_end()?)
onvif_src/stdsoap2.c(7268): malloc() = 0x51f6f8 not freed (memory leak or forgot to call soap_end()?)
onvif_src/stdsoap2.c(7268): malloc() = 0x51f728 not freed (memory leak or forgot to call soap_end()?)
onvif_src/stdsoap2.c(6665): malloc() = 0x51fb50 not freed (memory leak or forgot to call soap_end()?)
onvif_src/stdsoap2.c(8866): malloc() = 0x51fe70 not freed (memory leak or forgot to call soap_end()?)
onvif_src/stdsoap2.c(2142): malloc() = 0x5201c8 not freed (memory leak or forgot to call soap_end()?)
onvif_src/stdsoap2.c(7268): malloc() = 0x5201f0 not freed (memory leak or forgot to call soap_end()?)
onvif_src/stdsoap2.c(2164): malloc() = 0x520218 not freed (memory leak or forgot to call soap_end()?)
onvif_src/stdsoap2.c(8206): malloc() = 0x51f5e0 not freed (memory leak or forgot to call soap_end()?)
onvif_src/stdsoap2.c(8206): malloc() = 0x51f608 not freed (memory leak or forgot to call soap_end()?)
onvif_src/stdsoap2.c(8206): malloc() = 0x51f630 not freed (memory leak or forgot to call soap_end()?)
onvif_src/stdsoap2.c(7268): malloc() = 0x51f658 not freed (memory leak or forgot to call soap_end()?)
onvif_src/stdsoap2.c(7268): malloc() = 0x51f6e8 not freed (memory leak or forgot to call soap_end()?)
onvif_src/stdsoap2.c(7268): malloc() = 0x51f718 not freed (memory leak or forgot to call soap_end()?)
onvif_src/stdsoap2.c(7268): malloc() = 0x51f770 not freed (memory leak or forgot to call soap_end()?)
onvif_src/stdsoap2.c(7268): malloc() = 0x51f7a0 not freed (memory leak or forgot to call soap_end()?)
onvif_src/stdsoap2.c(6665): malloc() = 0x51fbc8 not freed (memory leak or forgot to call soap_end()?)
onvif_src/stdsoap2.c(8866): malloc() = 0x51fee8 not freed (memory leak or forgot to call soap_end()?)

//I omit the other output information which is not related to onvif debug

Data corruption in dynamic allocation (see logs)
Data corruption in dynamic allocation (see logs)
Data corruption in dynamic allocation (see logs)
Data corruption in dynamic allocation (see logs)
Data corruption in dynamic allocation (see logs)
Data corruption in dynamic allocation (see logs)
Data corruption in dynamic allocation (see logs)
Data corruption in dynamic allocation (see logs)
Data corruption in dynamic allocation (see logs)
Data corruption in dynamic allocation (see logs)
Data corruption in dynamic allocation (see logs)
Data corruption in dynamic allocation (see logs)

The  boa process can run without crash and the 3rd VMS can work correctly.And I found boa process use memory up to 50.3%.

[H[JMem: 44936K used, 1168K free, 0K shrd, 1044K buff, 7512K cached
Load average: 1.16 1.18 1.17 (Status: S=sleeping R=running, W=waiting)
[7m PID USER STATUS RSS PPID %CPU %MEM COMMAND[0m
272 root S 3756 1 12.7 8.1 av_server.out
682 root S 23304 1 11.8 50.3 boa
276 root S 1372 1 6.3 2.9 wis-streamer
723 root R 780 698 5.4 1.6 top
251 root S 1028 1 1.8 2.2 system_server
689 root S 1216 1 0.0 2.6 avahi-daemon
705 root S 884 1 0.0 1.9 upnp-scanip
698 root S 852 1 0.0 1.8 sh
291 root S 784 276 0.0 1.6 wis-streamer
283 root S 784 276 0.0 1.6 wis-streamer
290 root S 784 276 0.0 1.6 wis-streamer
486 root S 636 1 0.0 1.3 inetd
1 root S 552 0 0.0 1.1 init
685 root S 544 1 0.0 1.1 avahi-autoipd
694 root S 512 1 0.0 1.1 avahi-dnsconfd
686 root S 388 685 0.0 0.8 avahi-autoipd
295 bin S 368 1 0.0 0.7 portmap
164 root SW 0 1 0.0 0.0 mtdblockd
284 root Z 0 276 0.0 0.0 wis-streamer
71 root SW 0 14 0.0 0.0 pdflush
13 root SW< 0 1 0.0 0.0 khelper Data corruption in dynamic allocation (see logs)

 

So I guess there is an memory leak error in onvif code.Does anyone find it?And how to solve this problem?

Thank you very much

  • Hi,

    If there are any hanging messages in ControlSystemData in boa server, then you can end up in this crash log.

    boa has crashed due to hanging or stray messages and this has resulted in some unfreed memory showing as crash

    Can you give more details on what exact steps you did to get to this log?

    Regards,

    Raghu

  • Hi,

       I used 3rd VMS Axxon Smart Pro to connect the IPNC with ONVIF protocol.When VMS began to discover IPNC in local network, the IPNC terminal output the following information and boa process crash.

    Alignment trap: boa (682) PC=0x003d43c4 Instr=0xe5933000 Address=0xffffffff FSR 0x001
    [01/Jan/2000:04:03:18 +0000] caught SIGBUS, dumping core in /tmp

    So I want to debug the boa process and modify the Makefile in boa-0.94.13/src directory like the following:

    CFLAGS = -DDEBUG -pipe -Wall -I. -I$(PUBLIC_INCLUDE_DIR)

    After re-compile the source code,the boa binary code size reach to 11MB.

    Now I use 3rd VMS to discovery the IPNC again.When VMS began to discovery in local network,IPNC terminal output  the information like below :

    onvif_src/stdsoap2.c(2142): malloc() = 0x520150 not freed (memory leak or forgot to call soap_end()?)
    onvif_src/stdsoap2.c(7268): malloc() = 0x520178 not freed (memory leak or forgot to call soap_end()?)
    onvif_src/stdsoap2.c(2164): malloc() = 0x5201a0 not freed (memory leak or forgot to call soap_end()?)
    onvif_src/stdsoap2.c(8206): malloc() = 0x51f568 not freed (memory leak or forgot to call soap_end()?)
    onvif_src/stdsoap2.c(8206): malloc() = 0x51f590 not freed (memory leak or forgot to call soap_end()?)
    onvif_src/stdsoap2.c(8206): malloc() = 0x51f5b8 not freed (memory leak or forgot to call soap_end()?)
    onvif_src/stdsoap2.c(7268): malloc() = 0x51f5e0 not freed (memory leak or forgot to call soap_end()?)
    onvif_src/stdsoap2.c(7268): malloc() = 0x51f670 not freed (memory leak or forgot to call soap_end()?)
    onvif_src/stdsoap2.c(7268): malloc() = 0x51f6a0 not freed (memory leak or forgot to call soap_end()?)
    onvif_src/stdsoap2.c(7268): malloc() = 0x51f6f8 not freed (memory leak or forgot to call soap_end()?)
    onvif_src/stdsoap2.c(7268): malloc() = 0x51f728 not freed (memory leak or forgot to call soap_end()?)
    onvif_src/stdsoap2.c(6665): malloc() = 0x51fb50 not freed (memory leak or forgot to call soap_end()?)
    onvif_src/stdsoap2.c(8866): malloc() = 0x51fe70 not freed (memory leak or forgot to call soap_end()?)
    onvif_src/stdsoap2.c(2142): malloc() = 0x5201c8 not freed (memory leak or forgot to call soap_end()?)
    onvif_src/stdsoap2.c(7268): malloc() = 0x5201f0 not freed (memory leak or forgot to call soap_end()?)
    onvif_src/stdsoap2.c(2164): malloc() = 0x520218 not freed (memory leak or forgot to call soap_end()?)
    onvif_src/stdsoap2.c(8206): malloc() = 0x51f5e0 not freed (memory leak or forgot to call soap_end()?)
    onvif_src/stdsoap2.c(8206): malloc() = 0x51f608 not freed (memory leak or forgot to call soap_end()?)
    onvif_src/stdsoap2.c(8206): malloc() = 0x51f630 not freed (memory leak or forgot to call soap_end()?)
    onvif_src/stdsoap2.c(7268): malloc() = 0x51f658 not freed (memory leak or forgot to call soap_end()?)
    onvif_src/stdsoap2.c(7268): malloc() = 0x51f6e8 not freed (memory leak or forgot to call soap_end()?)
    onvif_src/stdsoap2.c(7268): malloc() = 0x51f718 not freed (memory leak or forgot to call soap_end()?)
    onvif_src/stdsoap2.c(7268): malloc() = 0x51f770 not freed (memory leak or forgot to call soap_end()?)
    onvif_src/stdsoap2.c(7268): malloc() = 0x51f7a0 not freed (memory leak or forgot to call soap_end()?)
    onvif_src/stdsoap2.c(6665): malloc() = 0x51fbc8 not freed (memory leak or forgot to call soap_end()?)
    onvif_src/stdsoap2.c(8866): malloc() = 0x51fee8 not freed (memory leak or forgot to call soap_end()?)

    After some time,it may be that VMS finished the discovery,the IPNC terminal output information change to :

    Data corruption in dynamic allocation (see logs)
    Data corruption in dynamic allocation (see logs)
    Data corruption in dynamic allocation (see logs)
    Data corruption in dynamic allocation (see logs)
    Data corruption in dynamic allocation (see logs)
    Data corruption in dynamic allocation (see logs)
    Data corruption in dynamic allocation (see logs)
    Data corruption in dynamic allocation (see logs)
    Data corruption in dynamic allocation (see logs)
    Data corruption in dynamic allocation (see logs)
    Data corruption in dynamic allocation (see logs)
    Data corruption in dynamic allocation (see logs)

    But the boa process do not crash and the VMS can display the video stream correctly.

    After that,every time VMS can connect to IPNC and display the video correctly.

    And I find many variables are defined in register type  in stdsoap2.c,such as:

    register char **q;

    Do these variables need high speed operation?If I make boa process output the debug information,Can boa process  work slowly and free memory correctly?

    Best Regards 

  • Hi,
    The false error messages are printed in the debug mode due a bug in the later versions of gSOAP (v2.8.1 and above). This can be fixed by editing the file stdsoap2.c found in ../Application/src/ipnc_app/network/boa-0.94.13/src/onvif_src/.  Line number 7354 must be placed outside the if-loop. This will solve the issue. Can you please try and let us know the outcome? Please use the below link, where a similar error has occurred and how it has been solved in gSOAP