| Summary: | C++ Messaging .NET Binding: copied objects lead to obscure memory access violations. | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise MRG | Reporter: | Chuck Rolke <crolke> | ||||
| Component: | qpid-sdk | Assignee: | Chuck Rolke <crolke> | ||||
| Status: | CLOSED ERRATA | QA Contact: | Petra Svobodová <psvobodo> | ||||
| Severity: | high | Docs Contact: | |||||
| Priority: | high | ||||||
| Version: | 1.3 | CC: | jross, lzhaldyb, psvobodo | ||||
| Target Milestone: | 3.0 | ||||||
| Target Release: | --- | ||||||
| Hardware: | All | ||||||
| OS: | Windows | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | 0.16 | Doc Type: | Bug Fix | ||||
| Doc Text: |
It was discovered that copied .NET Binding objects were not properly managed, which resulted in references to copies of deleted objects causing fatal System.AccessViolationException traps. The fix implements logic to detect deleted object references, and throw a catchable .NET exception that allows the user to continue.
|
Story Points: | --- | ||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2014-09-24 15:02: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: | |||||
| Attachments: |
|
||||||
|
Description
Chuck Rolke
2011-04-20 16:07:20 UTC
This problem is fixed upstream at checkin r1221824.
The following test program:
class Program {
static void Main(string[] args) {
Message msgA = new Message("abc");
Message msgB = msgA;
// Now msgA and msgB are .NET references to the same .NET Message.
// Disposing of either of them disposes of the other.
msgB.Dispose();
// Check that Message msgA is still safe
Console.WriteLine("Message msgA IsDisposed : {0}", msgA.IsDisposed);
// msgA is disposed. Reference it anyway and get the exception.
try
{
Console.WriteLine("Message msgA content = {0}", msgA.GetContent());
}
catch (Exception e)
{
Console.WriteLine("Exception {0}.", e);
}
}
}
Produces the following output:
Message msgA IsDisposed : True
Exception System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Org.Apache.Qpid.Messaging.Message'.
at Org.Apache.Qpid.Messaging.Message.ThrowIfDisposed()
in d:\qpid\cpp\bindings\qpid\dotnet\src\message.cpp:line 54
at Org.Apache.Qpid.Messaging.Message.GetContent()
in d:\qpid\cpp\bindings\qpid\dotnet\src\message.cpp:line 413
at Org.Apache.Qpid.Messaging.Program.Main(String[] args)
in D:\qpid\cpp\bindings\qpid\dotnet\examples\example\example.cs:line 127.
Clearly the ObjectDisposedException provides useful information for a user
who expects his exception handler to actually work.
Created attachment 549357 [details]
Setup instructions and code to test this bz using Managed C++
Microsoft .NET Managed C++ behaves differently from other .NET languages.
I set up a C++ project to characterize and to test this bug and in the process had several difficulties getting started. This attachment may help testers who want to get started using C++ instead of C#.
This bug has been fixed for a while (since 0.16). The bug was reproduced on qpid-cpp-win-3.0.0.5-1; on qpid-cpp-win-3.2.0.4-1 did not occur. References to deleted objects are detected and correct type of exception (System.ObjectDisposedException) is raised. Verified on packages qpid-cpp-win-3.22.5.1-1 on all supported Windows platforms: WindowsXP-x86, Windows7-x86 and x64, Windows Server2003-x86 and x64, Windows Server2008-x86, x64 and R2. --> VERIFIED 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/RHEA-2014-1296.html |