CESNET / ipfixcol

IPFIXcol is an implementation of an IPFIX (RFC 7011) collector
Other
64 stars 37 forks source link

[TCP] Core dumped when SIGTERM received after probing tcp port #188

Closed sirK84 closed 7 years ago

sirK84 commented 7 years ago

Hi,

I've found another issue:

Problem description: Core is dumped from ipfixcol (probably within ipfixcol-tcp-input.so) when program is requested to terminate, after checking ipfix port with nmap.

Ipfixcol version: 0.9.3 buildID: 520399

Test scenario

  1. start ipfixcol with tcp input plugin: $ ipfixcol -s -v3

  2. probe ipfix port e.g. with nmap: $ nmap -p 4739 127.0.0.1 Starting Nmap 7.01 ( https://nmap.org ) at 2017-06-09 11:25 CEST Nmap scan report for localhost (127.0.0.1) Host is up (0.00022s latency). PORT STATE SERVICE 4739/tcp open unknown Nmap done: 1 IP address (1 host up) scanned in 0.04 seconds

  3. terminate ipfixcol with either Ctrl + C or kill command: $ kill -15

Expected result: ipfixcol process terminates gracefully

Actual result: ipfixcol process terminates with core dump:

$ ipfixcol -s -v3
INFO: main: Using default configuration file: /usr/local/etc/ipfixcol/startup.xml
INFO: main: Using default internal configuration file: /usr/local/etc/ipfixcol/internalcfg.xml
INFO: main: No pidfile will be created
INFO: output manager: Configuring Output Manager in multiple manager mode
INFO: elements_collection: Description of 573 IPFIX elements loaded.
INFO: configurator: [18981] Opening input plugin: /usr/local/share/ipfixcol/plugins/ipfixcol-tcp-input.so
INFO: TCP input: Input plugin listening on ::, port 4739
INFO: TCP input: Plugin initialization completed successfully
INFO: configurator: [18981] Opening intermediate xml_conf: /usr/local/share/ipfixcol/plugins/ipfixcol-dummy-inter.so
INFO: dummy intermediate process: Successfully initialized
INFO: configurator: [18981] Opening storage xml_conf: /usr/local/share/ipfixcol/plugins/ipfixcol-ipfixviewer-output.so
INFO: configurator: No profile configuration
INFO: TCP input: Exporter connected from address ::ffff:127.0.0.1
ERROR: TCP input: Failed to receive IPFIX packet header: Connection reset by peer
INFO: TCP input: Exporter on address ::ffff:127.0.0.1 closed connection
Signal detected (15); exiting as soon as possible...
DEBUG: intermediate_process: NULL message; terminating intermediate process med:dummy_inter...
INFO: output manager: Closing Output Manager thread
*** Error in `ipfixcol': double free or corruption (out): 0x00007fe0800008f0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fe089b247e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x7fe0a)[0x7fe089b2ce0a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7fe089b3098c]
/usr/local/share/ipfixcol/plugins/ipfixcol-tcp-input.so(input_close+0x1f4)[0x7fe087318ee4]
ipfixcol[0x42c55d]
ipfixcol[0x42d4f1]
ipfixcol[0x42e120]
ipfixcol[0x416060]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7fe089acd830]
ipfixcol(_start+0x29)[0x4165a9]
======= Memory map: ========
00400000-00456000 r-xp 00000000 fd:00 787948                             /usr/local/bin/ipfixcol
00655000-00656000 r--p 00055000 fd:00 787948                             /usr/local/bin/ipfixcol
00656000-00657000 rw-p 00056000 fd:00 787948                             /usr/local/bin/ipfixcol
00c37000-00d50000 rw-p 00000000 00:00 0                                  [heap]
7fe080000000-7fe080021000 rw-p 00000000 00:00 0 
7fe080021000-7fe084000000 ---p 00000000 00:00 0 
7fe085060000-7fe085061000 ---p 00000000 00:00 0 
7fe085061000-7fe085861000 rw-p 00000000 00:00 0 
7fe085861000-7fe085863000 r-xp 00000000 fd:00 921468                     /usr/local/share/ipfixcol/plugins/ipfixcol-ipfixviewer-output.so
7fe085863000-7fe085a62000 ---p 00002000 fd:00 921468                     /usr/local/share/ipfixcol/plugins/ipfixcol-ipfixviewer-output.so
7fe085a62000-7fe085a63000 r--p 00001000 fd:00 921468                     /usr/local/share/ipfixcol/plugins/ipfixcol-ipfixviewer-output.so
7fe085a63000-7fe085a64000 rw-p 00002000 fd:00 921468                     /usr/local/share/ipfixcol/plugins/ipfixcol-ipfixviewer-output.so
7fe085a64000-7fe085a65000 ---p 00000000 00:00 0 
7fe085a65000-7fe086265000 rw-p 00000000 00:00 0 
7fe086265000-7fe086266000 r-xp 00000000 fd:00 921096                     /usr/local/share/ipfixcol/plugins/ipfixcol-dummy-inter.so
7fe086266000-7fe086465000 ---p 00001000 fd:00 921096                     /usr/local/share/ipfixcol/plugins/ipfixcol-dummy-inter.so
7fe086465000-7fe086466000 r--p 00000000 fd:00 921096                     /usr/local/share/ipfixcol/plugins/ipfixcol-dummy-inter.so
7fe086466000-7fe086467000 rw-p 00001000 fd:00 921096                     /usr/local/share/ipfixcol/plugins/ipfixcol-dummy-inter.so
7fe086467000-7fe086468000 ---p 00000000 00:00 0 
7fe086468000-7fe086c68000 rw-p 00000000 00:00 0 
7fe086c68000-7fe086e82000 r-xp 00000000 fd:00 790321                     /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
7fe086e82000-7fe087081000 ---p 0021a000 fd:00 790321                     /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
7fe087081000-7fe08709d000 r--p 00219000 fd:00 790321                     /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
7fe08709d000-7fe0870a9000 rw-p 00235000 fd:00 790321                     /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
7fe0870a9000-7fe0870ac000 rw-p 00000000 00:00 0 
7fe0870ac000-7fe08710a000 r-xp 00000000 fd:00 793856                     /lib/x86_64-linux-gnu/libssl.so.1.0.0
7fe08710a000-7fe08730a000 ---p 0005e000 fd:00 793856                     /lib/x86_64-linux-gnu/libssl.so.1.0.0
7fe08730a000-7fe08730e000 r--p 0005e000 fd:00 793856                     /lib/x86_64-linux-gnu/libssl.so.1.0.0
7fe08730e000-7fe087315000 rw-p 00062000 fd:00 793856                     /lib/x86_64-linux-gnu/libssl.so.1.0.0
7fe087315000-7fe08731c000 r-xp 00000000 fd:00 920081                     /usr/local/share/ipfixcol/plugins/ipfixcol-tcp-input.so
7fe08731c000-7fe08751b000 ---p 00007000 fd:00 920081                     /usr/local/share/ipfixcol/plugins/ipfixcol-tcp-input.so
7fe08751b000-7fe08751c000 r--p 00006000 fd:00 920081                     /usr/local/share/ipfixcol/plugins/ipfixcol-tcp-input.so
7fe08751c000-7fe08751d000 rw-p 00007000 fd:00 920081                     /usr/local/share/ipfixcol/plugins/ipfixcol-tcp-input.so
7fe08751d000-7fe088dd3000 r-xp 00000000 fd:00 2867                       /usr/lib/x86_64-linux-gnu/libicudata.so.55.1
7fe088dd3000-7fe088fd2000 ---p 018b6000 fd:00 2867                       /usr/lib/x86_64-linux-gnu/libicudata.so.55.1
7fe088fd2000-7fe088fd3000 r--p 018b5000 fd:00 2867                       /usr/lib/x86_64-linux-gnu/libicudata.so.55.1
7fe088fd3000-7fe088fd4000 rw-p 018b6000 fd:00 2867                       /usr/lib/x86_64-linux-gnu/libicudata.so.55.1
7fe088fd4000-7fe088ff5000 r-xp 00000000 fd:00 791381                     /lib/x86_64-linux-gnu/liblzma.so.5.0.0
7fe088ff5000-7fe0891f4000 ---p 00021000 fd:00 791381                     /lib/x86_64-linux-gnu/liblzma.so.5.0.0
7fe0891f4000-7fe0891f5000 r--p 00020000 fd:00 791381                     /lib/x86_64-linux-gnu/liblzma.so.5.0.0
7fe0891f5000-7fe0891f6000 rw-p 00021000 fd:00 791381                     /lib/x86_64-linux-gnu/liblzma.so.5.0.0
7fe0891f6000-7fe08920f000 r-xp 00000000 fd:00 788255                     /lib/x86_64-linux-gnu/libz.so.1.2.8
7fe08920f000-7fe08940e000 ---p 00019000 fd:00 788255                     /lib/x86_64-linux-gnu/libz.so.1.2.8
7fe08940e000-7fe08940f000 r--p 00018000 fd:00 788255                     /lib/x86_64-linux-gnu/libz.so.1.2.8
7fe08940f000-7fe089410000 rw-p 00019000 fd:00 788255                     /lib/x86_64-linux-gnu/libz.so.1.2.8
7fe089410000-7fe08958f000 r-xp 00000000 fd:00 2872                       /usr/lib/x86_64-linux-gnu/libicuuc.so.55.1
7fe08958f000-7fe08978f000 ---p 0017f000 fd:00 2872                       /usr/lib/x86_64-linux-gnu/libicuuc.so.55.1
7fe08978f000-7fe08979f000 r--p 0017f000 fd:00 2872                       /usr/lib/x86_64-linux-gnu/libicuuc.so.55.1
7fe08979f000-7fe0897a0000 rw-p 0018f000 fd:00 2872                       /usr/lib/x86_64-linux-gnu/libicuuc.so.55.1
7fe0897a0000-7fe0897a4000 rw-p 00000000 00:00 0 
7fe0897a4000-7fe0898ac000 r-xp 00000000 fd:00 788751                     /lib/x86_64-linux-gnu/libm-2.23.so
7fe0898ac000-7fe089aab000 ---p 00108000 fd:00 788751                     /lib/x86_64-linux-gnu/libm-2.23.so
7fe089aab000-7fe089aac000 r--p 00107000 fd:00 788751                     /lib/x86_64-linux-gnu/libm-2.23.so
7fe089aac000-7fe089aad000 rw-p 00108000 fd:00 788751                     /lib/x86_64-linux-gnu/libm-2.23.so
7fe089aad000-7fe089c6c000 r-xp 00000000 fd:00 788756                     /lib/x86_64-linux-gnu/libc-2.23.so
7fe089c6c000-7fe089e6c000 ---p 001bf000 fd:00 788756                     /lib/x86_64-linux-gnu/libc-2.23.so
7fe089e6c000-7fe089e70000 r--p 001bf000 fd:00 788756                     /lib/x86_64-linux-gnu/libc-2.23.so
7fe089e70000-7fe089e72000 rw-p 001c3000 fd:00 788756                     /lib/x86_64-linux-gnu/libc-2.23.so
7fe089e72000-7fe089e76000 rw-p 00000000 00:00 0 
7fe089e76000-7fe089e8e000 r-xp 00000000 fd:00 789938                     /lib/x86_64-linux-gnu/libpthread-2.23.so
7fe089e8e000-7fe08a08d000 ---p 00018000 fd:00 789938                     /lib/x86_64-linux-gnu/libpthread-2.23.so
7fe08a08d000-7fe08a08e000 r--p 00017000 fd:00 789938                     /lib/x86_64-linux-gnu/libpthread-2.23.so
7fe08a08e000-7fe08a08f000 rw-p 00018000 fd:00 789938                     /lib/x86_64-linux-gnu/libpthread-2.23.so
7fe08a08f000-7fe08a093000 rw-p 00000000 00:00 0 
7fe08a093000-7fe08a0a9000 r-xp 00000000 fd:00 787527                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7fe08a0a9000-7fe08a2a8000 ---p 00016000 fd:00 787527                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7fe08a2a8000-7fe08a2a9000 rw-p 00015000 fd:00 787527                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7fe08a2a9000-7fe08a45a000 r-xp 00000000 fd:00 2888                       /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.3
7fe08a45a000-7fe08a659000 ---p 001b1000 fd:00 2888                       /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.3
7fe08a659000-7fe08a661000 r--p 001b0000 fd:00 2888                       /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.3
7fe08a661000-7fe08a663000 rw-p 001b8000 fd:00 2888                       /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.3
7fe08a663000-7fe08a664000 rw-p 00000000 00:00 0 
7fe08a664000-7fe08a667000 r-xp 00000000 fd:00 788747                     /lib/x86_64-linux-gnu/libdl-2.23.so
7fe08a667000-7fe08a866000 ---p 00003000 fd:00 788747                     /lib/x86_64-linux-gnu/libdl-2.23.so
7fe08a866000-7fe08a867000 r--p 00002000 fd:00 788747                     /lib/x86_64-linux-gnu/libdl-2.23.so
7fe08a867000-7fe08a868000 rw-p 00003000 fd:00 788747                     /lib/x86_64-linux-gnu/libdl-2.23.so
7fe08a868000-7fe08a9da000 r-xp 00000000 fd:00 1187                       /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7fe08a9da000-7fe08abda000 ---p 00172000 fd:00 1187                       /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7fe08abda000-7fe08abe4000 r--p 00172000 fd:00 1187                       /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7fe08abe4000-7fe08abe6000 rw-p 0017c000 fd:00 1187                       /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7fe08abe6000-7fe08abea000 rw-p 00000000 00:00 0 
7fe08abea000-7fe08ac10000 r-xp 00000000 fd:00 788760                     /lib/x86_64-linux-gnu/ld-2.23.so
7fe08add6000-7fe08adde000 rw-p 00000000 00:00 0 
7fe08ae0c000-7fe08ae0f000 rw-p 00000000 00:00 0 
7fe08ae0f000-7fe08ae10000 r--p 00025000 fd:00 788760                     /lib/x86_64-linux-gnu/ld-2.23.so
7fe08ae10000-7fe08ae11000 rw-p 00026000 fd:00 788760                     /lib/x86_64-linux-gnu/ld-2.23.so
7fe08ae11000-7fe08ae12000 rw-p 00000000 00:00 0 
7fffdc927000-7fffdc948000 rw-p 00000000 00:00 0                          [stack]
7fffdc959000-7fffdc95b000 r--p 00000000 00:00 0                          [vvar]
7fffdc95b000-7fffdc95d000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Aborted (core dumped)

Attachments: core, binary and stdout

Kind Regards Krzysztof

thorgrin commented 7 years ago

Hi,

This issue was fixed in commit 6df2fc261730327a3411332df56ad2ddd025617d but I did not build a new package for it yet. I'll do that next week and update this issue.

Thanks for your patience

sirK84 commented 7 years ago

Sorry , I didn't check that. Ayway many thanks for the fix and have a great weekend ;-)

thorgrin commented 7 years ago

No problem, you could not have known that some devel release fixed this. Anyway, IPFIXcol 0.9.4 is released now including COPR packages and it includes the bugfix as well.