Bug 668580 - .NET Binding to C++ Messaging missing locks around resource destructors
Summary: .NET Binding to C++ Messaging missing locks around resource destructors
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise MRG
Classification: Red Hat
Component: qpid-sdk
Version: 1.3
Hardware: Unspecified
OS: Windows
low
high
Target Milestone: 2.0
: ---
Assignee: Chuck Rolke
QA Contact: Petra Svobodová
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-01-10 20:14 UTC by Chuck Rolke
Modified: 2011-08-12 16:47 UTC (History)
3 users (show)

Fixed In Version: 1.3.8.1
Doc Type: Bug Fix
Doc Text:
Cause: Messaging binding object access was not properly interlocked. Consequence: Under certain circumstances object deletions could fail with an access violation. Fix: Add interlocks to serialize references to objects being deleted. Result: Object deletions no longer fail due to access violations.
Clone Of:
Environment:
Last Closed: 2011-06-23 15:49:36 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Demo to show locks working/failing. (4.68 KB, patch)
2011-03-09 18:29 UTC, Chuck Rolke
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2011:0890 0 normal SHIPPED_LIVE Red Hat Enterprise MRG Messaging 2.0 Release 2011-06-23 15:42:41 UTC

Description Chuck Rolke 2011-01-10 20:14:42 UTC
Description of problem:

None of the binding objects has a lock around the code that deletes the kept object resource. If a client application deletes aliased copies of the object from multiple threads then the application will crash with an access violation.

Version-Release number of selected component (if applicable):

1.3.0.24

How reproducible:

Unseen in the wild. 100% in staged tests.

Steps to Reproduce:
1. Create aliased copies of a single Message in multiple threads.
2. All threads try to delete the object at the same time.
3.
  
Actual results:

Access violation exception when code executes "delete 0;".

Expected results:

No access violations.

Additional info:

Grep the code for "TODO: add lock". Several hits found.

Comment 1 Chuck Rolke 2011-01-10 20:47:19 UTC
Fixed upstream at r1057350

Comment 2 Frantisek Reznicek 2011-03-09 09:47:13 UTC
Hi Chuck,
could you possibly attach an example of above described scenario, please?

Attached example can drastically reduce validation effort on this defect.

Comment 3 Chuck Rolke 2011-03-09 18:27:31 UTC
Hi Frantisek,

Yes, I'm attaching a patch. It's based at qpid/cpp/bindings/qpid/dotnet.
It modifies two files:
 1. Message.cpp - adds a delay in the Finalizer to make the collision-that-needs-locking window much larger.
 2. *.helloworld.cs - Rewrites the whole file to become a lock test. Instructions and theory are comments in this file. You have to run the program twice: once with the locks in place to see them work, and once with the locks removed (edit Message.cpp - rebuild org.apache.qpid.messaging.dll) to see the access violation.

-Chuck

Comment 4 Chuck Rolke 2011-03-09 18:29:53 UTC
Created attachment 483282 [details]
Demo to show locks working/failing.

Comment 5 Chuck Rolke 2011-03-15 15:19:51 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause: Messaging binding object access was not properly interlocked.

Consequence: Under certain circumstances object deletions could fail with an access violation.

Fix: Add interlocks to serialize references to objects being deleted.

Result: Object deletions no longer fail due to access violations.

Comment 7 Petra Svobodová 2011-05-11 07:25:53 UTC
Object deletions caused by client applications do not fail due to access violation any more. Tested on the package qpid-cpp-*-2.0.0.4.

--> VERIFIED

Comment 8 errata-xmlrpc 2011-06-23 15:49:36 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2011-0890.html


Note You need to log in before you can comment on or make changes to this bug.