CESNET / ipfixcol

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

[SCTP] ERROR Unable to unregister the source from the main template manager! #187

Closed sirK84 closed 7 years ago

sirK84 commented 7 years ago

Hi,

Could you help me with following case:

Problem description: Storage plugin is not closed properly if SCTP exporter disconnects without sending any ipfix data.

Ipfixcol version: 0.9.3 buildID: 520399

Test scenario

  1. start ipfixcol with dummy storage plugin (implementation attached): $ ipfixcol -s -v3

  2. establish new SCTP association e.g. with sctp_darn: $ sctp_darn -H 127.0.0.1 -h 127.0.0.1 -p 4739 -s sctp_darn ready to send... 127.0.0.1:0-127.0.0.1:4739> Recieved SCTP_COMM_UP New connection, peer addresses 127.0.0.1:4739 10.0.2.15:4739 192.168.99.101:4739 172.17.0.1:4739 127.0.0.1:0-127.0.0.1:4739>

  3. close association with Ctrl + C

Expected result: Storage plugin is closed properly after exporter disconnects (or not initialized at all since there is no data sent)

Actual result: Storage plugin initializes after exporter is disconnected and could not be closed. To close plugin main application shutdown is required:

INFO: SCTP input: New SCTP association from ::ffff:127.0.0.1
WARNING: SCTP input: Packet header is incomplete; skipping message...
INFO: SCTP input: SCTP input plugin: Exporter disconnected
DEBUG: dummy intermediate process: [0] Received IPFIX message
INFO: test_storage: TEST_STORAGE STARTING
INFO: output manager: [0] Data Manager created
DEBUG: output manager: [0] Closed source
ERROR: output manager: [0] Unable to unregister the source from the main template manager!
...
Signal detected (2); exiting as soon as possible...
INFO: test_storage: STORAGE PLUGIN CLOSED

Attachments:

  1. Storage plugin implementation
  2. Console output
  3. Message flow

Kind Regards Krzysztof

thorgrin commented 7 years ago

Thank you for reporting the issue in such a fine detail, it helped a lot.

The storage plugin is opened as soon as there is a connection which is not in a new state (carries some valid IPFIX header). However, the handling of close message in SCTP expected that the connection has already initialized the storage plugin. I've just added a check for closing of connections in a new state and it works for me.