Bug 929098

Summary: CPG: Corosync can duplicate and/or lost messages - Local IPC
Product: Red Hat Enterprise Linux 6 Reporter: Libor Miksik <lmiksik>
Component: corosyncAssignee: Jan Friesse <jfriesse>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 6.4CC: abienven, bmarson, cluster-maint, jfriesse, jkortus, mjuricek, perfbz, pm-eus, sdake
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: corosync-1.4.1-4.el6_2.5 Doc Type: Bug Fix
Doc Text:
When running applications which used the Corosync IPC library, some messages in the dispatch() function were lost or duplicated. This update properly checks the return values of the dispatch_put() function, returns the correct remaining bytes in the IPC ring buffer, and ensures that the IPC client is correctly informed about the real number of messages in the ring buffer. Now, messages in the dispatch() function are no longer lost or duplicated.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-04-09 10:29:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 922671    
Bug Blocks:    
Attachments:
Description Flags
6.2.z-bz929098-1-Put-handle-to-hdb-in-dispatch-on-unknown-message
none
6.2.z-bz929098-2-Properly-check-result-of-coroipcc_dispatch_put
none
6.2.z-bz929098-3-coroipcs-Ensure-rb-data-are-not-overwritten
none
6.2.z-bz929098-4-Properly-lock-pending_semops none

Description Libor Miksik 2013-03-29 09:18:13 UTC
This bug has been copied from bug #922671 and has been proposed
to be backported to 6.2 z-stream (EUS).

Comment 4 Jan Friesse 2013-03-29 11:26:01 UTC
Created attachment 718032 [details]
6.2.z-bz929098-1-Put-handle-to-hdb-in-dispatch-on-unknown-message


Put handle to hdb in dispatch on unknown message

When we receive unknown dispatch type, we should put handle to hdb,
because it was correctly obtained. This problem is only cfg and confdb
libraries, cpg, evs, quorum, ... are not affected and works correctly.

Signed-off-by: Jan Friesse <jfriesse>
Reviewed-by: Fabio M. Di Nitto <fdinitto>

Comment 5 Jan Friesse 2013-03-29 11:26:04 UTC
Created attachment 718033 [details]
6.2.z-bz929098-2-Properly-check-result-of-coroipcc_dispatch_put


Properly check result of coroipcc_dispatch_put

When result of coroipcc_dispatch_put it can happen, that one message is
delivered to user application multiple times.

Signed-off-by: Jan Friesse <jfriesse>
Reviewed-by: Fabio M. Di Nitto <fdinitto>

Comment 6 Jan Friesse 2013-03-29 11:26:07 UTC
Created attachment 718034 [details]
6.2.z-bz929098-3-coroipcs-Ensure-rb-data-are-not-overwritten


coroipcs: Ensure rb data are not overwritten

With introduce of rb alignment (55600762), it's not enough to subtract
one from number of free bytes, but also alignment must be taken to
account. Easiest solution is to subtract 9 bytes.

Signed-off-by: Jan Friesse <jfriesse>
Reviewed-by: Steven Dake <sdake>

Comment 7 Jan Friesse 2013-03-29 11:26:10 UTC
Created attachment 718035 [details]
6.2.z-bz929098-4-Properly-lock-pending_semops


Properly lock pending_semops

pending_semops variable can be changed in two threads. One is actual IPC
connection and second is coropoll. It's really scholar example of race
(one thread doing i++, second doing i--). If socket is full, it can
happen that IPC will increase value and coropoll will decrease,
resulting in unpredictable value. This means, that client IPC can be
informed about more messages then really available, resulting
in reading of garbage messages in library dispatch function.

Solution is to properly lock variable.

Signed-off-by: Jan Friesse <jfriesse>
Reviewed-by: Fabio M. Di Nitto <fdinitto>

Comment 11 errata-xmlrpc 2013-04-09 10:29:36 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0724.html