[ZBX-10154] sender.pl fragments header, so it's not robust enough to communicate with zabbix processes Created: 2015 Dec 11  Updated: 2017 May 30  Resolved: 2015 Dec 21

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Installation (I)
Affects Version/s: None
Fix Version/s: 2.2.12rc1, 2.4.8rc1, 3.0.0alpha5

Type: Incident report Priority: Trivial
Reporter: Oleksii Zagorskyi Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: fragmentation, sender, troubleshooting
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File fragmented-ZBXD-header.png     File sender-script.patch    
Issue Links:
Duplicate
duplicates ZBX-8914 Server incorrectly parses header, if ... Closed

 Description   

We have a script for troubleshooting in misc/debug folder (in SVN only).
If for example use it (for integration with 3rd applications etc) to get queue on a zabbix server you will see that in command line in random cases a result returned is empty or looks like a line wrap.

If turn on debug log for trappers and capture traffic by wiresharc it get's clear that a ZBXDx01XXXXXXXX header for request is fragmented and on edge cases it became a problem.
For example after 2 PSH packets received from the script (ZBXBx01 and x65) - zabbix trapper closes connections by sending FIN packet.
In debug log we can see:

  8207:20151211:105204.701 trapper #1 [processing data]
  8207:20151211:105204.703 trapper #1 [processed data in 0.001576 sec, waiting for connection]

But sometimes the header is split to 5 PSH packets (data in 6th PSH packet) and it was successfully
proceed by zabbix trapper.

I guess we should improve the script to perform only one push after constructing the header.

Queue protocol is here http://zabbix.org/wiki/Docs/protocols/queue/2.2

Debug log of a successful request:

  8207:20151211:105205.665 trapper #1 [processing data]
  8207:20151211:105205.667 trapper got '{
    "request": "queue.get",
    "sid": "b5a5f54c05a066a02cefc71cf0f3543f",
    "type": "overview"
}'
  8207:20151211:105205.667 In recv_getqueue()
  8207:20151211:105205.667 query [txnlev:0] [select null from users u,sessions s where u.userid=s.userid and s.status=0 and s.sessionid='b5a5f54c05a066a02cefc71cf0f3543f' and u.type>=
3]
  8207:20151211:105205.667 recv_getqueue() json.buffer:'{"response":"success","data":[{"itemtype":5,"delay5":0,"delay10":0,"delay30":0,"delay60":0,"delay300":0,"delay600":32}]}'
  8207:20151211:105205.667 End of recv_getqueue()
  8207:20151211:105205.667 trapper #1 [processed data in 0.002147 sec, waiting for connection]

Mentioned 2 session captures can be seen on a screenshot.



 Comments   
Comment by Glebs Ivanovskis (Inactive) [ 2015 Dec 14 ]

I've attached a simple patch for sender.pl script. It disables automatic flushing of print buffer into socket buffer while we write data length byte by byte into it.

However, we decided to fix this (and linked related) issue on Zabbix daemon side.

Comment by richlv [ 2015 Dec 14 ]

how about still applying the sender.pl patch so it's usable with older versions of the zabbix processes ?

Comment by Glebs Ivanovskis (Inactive) [ 2015 Dec 15 ]

Good idea, thank you, richlv!

Sender script fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-10154-22 revision 57201.

Work on daemon side will be continued under ZBX-8914.

Comment by Aleksandrs Saveljevs [ 2015 Dec 21 ]

sender.pl improvement looks good!

Comment by Glebs Ivanovskis (Inactive) [ 2015 Dec 21 ]

Fixed in pre-2.2.12rc1 r57309, pre-2.4.8rc1 r57310, pre-3.0.0alpha5 (trunk) r57311.

Generated at Sat Apr 20 01:11:57 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.