You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by qpid user 2 <qp...@gmail.com> on 2010/10/01 19:10:46 UTC

Issue with C# binding libraries

Hi folks,

I am having an issue with C# binding dll when trying to connect to the
broker. This issue only happens in Release mode. I get an exception when
trying to instantiate a Connection object and pass on a connection url to
target the broker. the original exception is AccessViolationException:
"Attempted to read or write protected memory. This is often an indication
that other memory is corrupt.". and it happens in Connection.cpp when
QpidMarshal::ToNative(url) returns. I am assuming that this function is
responsible to convert managed strings into a native encoding.

Can someone provide some help on this? Any help would be much appreciated.

I can provide more detailed info if necessary.

Thanks.
Qpid.User.2!

Re: Issue with C# binding libraries

Posted by Ted Ross <tr...@redhat.com>.
We're seeing the same thing happen and we're looking for a solution.  
I'll follow up on this list with anything we learn.

-Ted


On 10/05/2010 11:34 AM, qpid user 2 wrote:
> Guys. Sorry but I am still struggling with this issue. I thought maybe the
> issue linked below is related and can fix it. its related to how managed
> objects are cloned on csharp wrapper. I built from the head rev but does not
> seem to be the case. Could you guys help me on this?
>
> Just to refresh mind, the problem is that I get exception when using the
> dotnet binding library ONLY in Release mode. The debug mode works fine.
> Following is the stack trace of the exception:
>
> System.AccessViolationException was unhandled
>    Message="Attempted to read or write protected memory. This is often an
> indication that other memory is corrupt."
>    Source="org.apache.qpid.messaging"
>    StackTrace:
>         at qpid.messaging.Connection.{ctor}(Connection* ,
> basic_string<char\,std::char_traits<char>\,std::allocator<char>  >* ,
> map<std::basic_string<char\,std::char_traits<char>\,std::allocator<char>
>    
>> \,qpid::types::Variant\,std::less<std::basic_string<char\,std::char_traits<char>\,std::allocator<char>
>>
>> \,std::allocator<std::pair<std::basic_string<char\,std::char_traits<char>\,std::allocator<char>
>> const \,qpid::types::Variant>  >  >* )
>>      
>         at Org.Apache.Qpid.Messaging.Connection..ctor(String url) in
> c:\rimprojects\dev\enterprise\instrumentation\enterprise\instrumentation\vendor\qpid-0.6x\cpp\bindings\qpid\dotnet\src\connection.cpp:line
> 48
>         at Rim.Core.Instrumentation.Utilities.AgentConnection..ctor(String
> ConnectionStr) in
> C:\rimProjects\dev\Enterprise\INSTRUMENTATION\enterprise\instrumentation\shared\csharp\Source\Utilities\Connection.cs:line
> 39
>         at Rim.Core.Instrumentation.Utilities.Sinks.AgentSink..ctor() in
> C:\rimProjects\dev\Enterprise\INSTRUMENTATION\enterprise\instrumentation\shared\csharp\Source\Utilities\Sinks.cs:line
> 72
>         at Rim.Core.Instrumentation.Examples.Bes.Program.Main(String[] args)
> in
> C:\rimProjects\dev\Enterprise\INSTRUMENTATION\enterprise\instrumentation\client\csharp\BES\Examples\ExampleUsage.cs:line
> 29
>         at System.AppDomain._nExecuteAssembly(Assembly assembly, String[]
> args)
>         at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
> assemblySecurity, String[] args)
>         at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
>         at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
>         at System.Threading.ExecutionContext.Run(ExecutionContext
> executionContext, ContextCallback callback, Object state)
>         at System.Threading.ThreadHelper.ThreadStart()
>    InnerException:
>
>
>
> Any help would be appreciated.
>
> On Fri, Oct 1, 2010 at 3:55 PM, qpid user 2<qp...@gmail.com>  wrote:
>
>    
>> Adding the link would help:
>> https://issues.apache.org/jira/browse/QPID-2798
>>
>> The issue reported sound like the one I am facing now.
>>
>> Thanks
>>
>>
>> On Fri, Oct 1, 2010 at 3:54 PM, qpid user 2<qp...@gmail.com>  wrote:
>>
>>      
>>> Thanks Ted. I found this issue reported by you and a fix has already been
>>> patched for it. Is it related to the same issue?
>>>
>>>
>>> On Fri, Oct 1, 2010 at 2:52 PM, Ted Ross<tr...@redhat.com>  wrote:
>>>
>>>        
>>>>   You're right, that's not a very good URL.
>>>>
>>>> The thread started with a message from Chuck Rolke with subject "Help
>>>> with Windows app design" on 9/21/2010 12:00PM EDT.  The text of his message
>>>> was:
>>>>
>>>> ========
>>>>
>>>> Hi,
>>>>
>>>> I'm working with the qpid cpp messaging dotnet client. A quick review: user programs are in a .NET managed language, say C#. They refer to an Interop DLL that connects them to the unmanaged qpid messaging layer built by qpid/cpp.
>>>>
>>>> Running under debug things are fine. However, when I switch to Release or RelWithDebInfo, the qpid messaging DLL functions crash in the function prologue while it is trying to install it's exception handler. I've reproduced that failing call chain below. It acts like the FS:[0] chain is read-only.
>>>>
>>>>  From reading John Robbins I suspect that default exception handling being synchronous in Debug and asynchronous in Release may be an issue but I can't pinpoint it. All the qpid messaging dlls are linked the same (/EHsc, Multi-threaded DLL) for Debug and Release. In Debug mode one can step through writing to FS:[0] just fine.
>>>>
>>>> I'd appreciate some discussion.
>>>>
>>>> Regards,
>>>> Chuck
>>>>
>>>> C# code
>>>> =======
>>>>
>>>>      connection = new Connection(broker);
>>>>
>>>> C++ Binding DLL
>>>> ===============
>>>>
>>>>      Connection::Connection(System::String ^ url) :
>>>>          connectionp(new ::qpid::messaging::Connection(QpidMarshal::ToNative(url)))
>>>>      {
>>>>      }
>>>>
>>>> Qpid Messaging DLL
>>>> ==================
>>>>
>>>> qpid::messaging::Connection::Connection:
>>>>
>>>>    6264E580  push        0FFFFFFFFh
>>>>    6264E582  push        626841EBh
>>>>    6264E587  mov         eax,dword ptr fs:[00000000h]
>>>>    6264E58D  push        eax
>>>>    6264E58E  push        ecx
>>>>    6264E58F  push        esi
>>>>    6264E590  mov         eax,dword ptr [___security_cookie (626A92D0h)]
>>>>    6264E595  xor         eax,esp
>>>>    6264E597  push        eax
>>>>    6264E598  lea         eax,[esp+0Ch]
>>>>    6264E59C  mov         dword ptr fs:[00000000h],eax<--- fails here
>>>>    6264E5A2  mov         esi,ecx
>>>>    6264E5A4  push        1F8h
>>>>    6264E5A9  mov         dword ptr [esi],0
>>>>    6264E5AF  call        operator new (62682202h)
>>>>
>>>> ---------------------------------------------------------------------
>>>> Apache Qpid - AMQP Messaging Implementation
>>>> Project:      http://qpid.apache.org
>>>> Use/Interact: mailto:dev-subscribe@qpid.apache.org<de...@qpid.apache.org>
>>>>
>>>>
>>>> ========
>>>>
>>>>
>>>> On 10/01/2010 02:19 PM, qpid user 2 wrote:
>>>>
>>>> Sorry Ted but I cant seem to find the thread there. Do you mind pointing
>>>> me to the discussion there?
>>>>
>>>> Thanks
>>>>
>>>>
>>>> On Fri, Oct 1, 2010 at 1:27 PM, Ted Ross<tr...@redhat.com>  wrote:
>>>>
>>>>          
>>>>>   On 10/01/2010 01:10 PM, qpid user 2 wrote:
>>>>>
>>>>>            
>>>>>> Hi folks,
>>>>>>
>>>>>> I am having an issue with C# binding dll when trying to connect to the
>>>>>> broker. This issue only happens in Release mode. I get an exception
>>>>>> when
>>>>>> trying to instantiate a Connection object and pass on a connection url
>>>>>> to
>>>>>> target the broker. the original exception is AccessViolationException:
>>>>>> "Attempted to read or write protected memory. This is often an
>>>>>> indication
>>>>>> that other memory is corrupt.". and it happens in Connection.cpp when
>>>>>> QpidMarshal::ToNative(url) returns. I am assuming that this function is
>>>>>> responsible to convert managed strings into a native encoding.
>>>>>>
>>>>>> Can someone provide some help on this? Any help would be much
>>>>>> appreciated.
>>>>>>
>>>>>> I can provide more detailed info if necessary.
>>>>>>
>>>>>> Thanks.
>>>>>> Qpid.User.2!
>>>>>>
>>>>>>
>>>>>>
>>>>>>              
>>>>>   QU2,
>>>>>
>>>>> This has been seen before (see this thread on dev:
>>>>> http://mail-archives.apache.org/mod_mbox/qpid-dev/201009.mbox/browser).
>>>>>
>>>>> -Ted
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> Apache Qpid - AMQP Messaging Implementation
>>>>> Project:      http://qpid.apache.org
>>>>> Use/Interact: mailto:users-subscribe@qpid.apache.org
>>>>>
>>>>>
>>>>>            
>>>>
>>>>          
>>>        
>>      
>    


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Issue with C# binding libraries

Posted by qpid user 2 <qp...@gmail.com>.
Guys. Sorry but I am still struggling with this issue. I thought maybe the
issue linked below is related and can fix it. its related to how managed
objects are cloned on csharp wrapper. I built from the head rev but does not
seem to be the case. Could you guys help me on this?

Just to refresh mind, the problem is that I get exception when using the
dotnet binding library ONLY in Release mode. The debug mode works fine.
Following is the stack trace of the exception:

System.AccessViolationException was unhandled
  Message="Attempted to read or write protected memory. This is often an
indication that other memory is corrupt."
  Source="org.apache.qpid.messaging"
  StackTrace:
       at qpid.messaging.Connection.{ctor}(Connection* ,
basic_string<char\,std::char_traits<char>\,std::allocator<char> >* ,
map<std::basic_string<char\,std::char_traits<char>\,std::allocator<char>
>\,qpid::types::Variant\,std::less<std::basic_string<char\,std::char_traits<char>\,std::allocator<char>
>
>\,std::allocator<std::pair<std::basic_string<char\,std::char_traits<char>\,std::allocator<char>
> const \,qpid::types::Variant> > >* )
       at Org.Apache.Qpid.Messaging.Connection..ctor(String url) in
c:\rimprojects\dev\enterprise\instrumentation\enterprise\instrumentation\vendor\qpid-0.6x\cpp\bindings\qpid\dotnet\src\connection.cpp:line
48
       at Rim.Core.Instrumentation.Utilities.AgentConnection..ctor(String
ConnectionStr) in
C:\rimProjects\dev\Enterprise\INSTRUMENTATION\enterprise\instrumentation\shared\csharp\Source\Utilities\Connection.cs:line
39
       at Rim.Core.Instrumentation.Utilities.Sinks.AgentSink..ctor() in
C:\rimProjects\dev\Enterprise\INSTRUMENTATION\enterprise\instrumentation\shared\csharp\Source\Utilities\Sinks.cs:line
72
       at Rim.Core.Instrumentation.Examples.Bes.Program.Main(String[] args)
in
C:\rimProjects\dev\Enterprise\INSTRUMENTATION\enterprise\instrumentation\client\csharp\BES\Examples\ExampleUsage.cs:line
29
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[]
args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:



Any help would be appreciated.

On Fri, Oct 1, 2010 at 3:55 PM, qpid user 2 <qp...@gmail.com> wrote:

> Adding the link would help:
> https://issues.apache.org/jira/browse/QPID-2798
>
> The issue reported sound like the one I am facing now.
>
> Thanks
>
>
> On Fri, Oct 1, 2010 at 3:54 PM, qpid user 2 <qp...@gmail.com> wrote:
>
>> Thanks Ted. I found this issue reported by you and a fix has already been
>> patched for it. Is it related to the same issue?
>>
>>
>> On Fri, Oct 1, 2010 at 2:52 PM, Ted Ross <tr...@redhat.com> wrote:
>>
>>>  You're right, that's not a very good URL.
>>>
>>> The thread started with a message from Chuck Rolke with subject "Help
>>> with Windows app design" on 9/21/2010 12:00PM EDT.  The text of his message
>>> was:
>>>
>>> ========
>>>
>>> Hi,
>>>
>>> I'm working with the qpid cpp messaging dotnet client. A quick review: user programs are in a .NET managed language, say C#. They refer to an Interop DLL that connects them to the unmanaged qpid messaging layer built by qpid/cpp.
>>>
>>> Running under debug things are fine. However, when I switch to Release or RelWithDebInfo, the qpid messaging DLL functions crash in the function prologue while it is trying to install it's exception handler. I've reproduced that failing call chain below. It acts like the FS:[0] chain is read-only.
>>>
>>> From reading John Robbins I suspect that default exception handling being synchronous in Debug and asynchronous in Release may be an issue but I can't pinpoint it. All the qpid messaging dlls are linked the same (/EHsc, Multi-threaded DLL) for Debug and Release. In Debug mode one can step through writing to FS:[0] just fine.
>>>
>>> I'd appreciate some discussion.
>>>
>>> Regards,
>>> Chuck
>>>
>>> C# code
>>> =======
>>>
>>>     connection = new Connection(broker);
>>>
>>> C++ Binding DLL
>>> ===============
>>>
>>>     Connection::Connection(System::String ^ url) :
>>>         connectionp(new ::qpid::messaging::Connection(QpidMarshal::ToNative(url)))
>>>     {
>>>     }
>>>
>>> Qpid Messaging DLL
>>> ==================
>>>
>>> qpid::messaging::Connection::Connection:
>>>
>>>   6264E580  push        0FFFFFFFFh
>>>   6264E582  push        626841EBh
>>>   6264E587  mov         eax,dword ptr fs:[00000000h]
>>>   6264E58D  push        eax
>>>   6264E58E  push        ecx
>>>   6264E58F  push        esi
>>>   6264E590  mov         eax,dword ptr [___security_cookie (626A92D0h)]
>>>   6264E595  xor         eax,esp
>>>   6264E597  push        eax
>>>   6264E598  lea         eax,[esp+0Ch]
>>>   6264E59C  mov         dword ptr fs:[00000000h],eax        <--- fails here
>>>   6264E5A2  mov         esi,ecx
>>>   6264E5A4  push        1F8h
>>>   6264E5A9  mov         dword ptr [esi],0
>>>   6264E5AF  call        operator new (62682202h)
>>>
>>> ---------------------------------------------------------------------
>>> Apache Qpid - AMQP Messaging Implementation
>>> Project:      http://qpid.apache.org
>>> Use/Interact: mailto:dev-subscribe@qpid.apache.org <de...@qpid.apache.org>
>>>
>>>
>>> ========
>>>
>>>
>>> On 10/01/2010 02:19 PM, qpid user 2 wrote:
>>>
>>> Sorry Ted but I cant seem to find the thread there. Do you mind pointing
>>> me to the discussion there?
>>>
>>> Thanks
>>>
>>>
>>> On Fri, Oct 1, 2010 at 1:27 PM, Ted Ross <tr...@redhat.com> wrote:
>>>
>>>>  On 10/01/2010 01:10 PM, qpid user 2 wrote:
>>>>
>>>>> Hi folks,
>>>>>
>>>>> I am having an issue with C# binding dll when trying to connect to the
>>>>> broker. This issue only happens in Release mode. I get an exception
>>>>> when
>>>>> trying to instantiate a Connection object and pass on a connection url
>>>>> to
>>>>> target the broker. the original exception is AccessViolationException:
>>>>> "Attempted to read or write protected memory. This is often an
>>>>> indication
>>>>> that other memory is corrupt.". and it happens in Connection.cpp when
>>>>> QpidMarshal::ToNative(url) returns. I am assuming that this function is
>>>>> responsible to convert managed strings into a native encoding.
>>>>>
>>>>> Can someone provide some help on this? Any help would be much
>>>>> appreciated.
>>>>>
>>>>> I can provide more detailed info if necessary.
>>>>>
>>>>> Thanks.
>>>>> Qpid.User.2!
>>>>>
>>>>>
>>>>>
>>>>  QU2,
>>>>
>>>> This has been seen before (see this thread on dev:
>>>> http://mail-archives.apache.org/mod_mbox/qpid-dev/201009.mbox/browser).
>>>>
>>>> -Ted
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> Apache Qpid - AMQP Messaging Implementation
>>>> Project:      http://qpid.apache.org
>>>> Use/Interact: mailto:users-subscribe@qpid.apache.org
>>>>
>>>>
>>>
>>>
>>
>

Re: Issue with C# binding libraries

Posted by Ted Ross <tr...@redhat.com>.
On 10/01/2010 01:10 PM, qpid user 2 wrote:
> Hi folks,
>
> I am having an issue with C# binding dll when trying to connect to the
> broker. This issue only happens in Release mode. I get an exception when
> trying to instantiate a Connection object and pass on a connection url to
> target the broker. the original exception is AccessViolationException:
> "Attempted to read or write protected memory. This is often an indication
> that other memory is corrupt.". and it happens in Connection.cpp when
> QpidMarshal::ToNative(url) returns. I am assuming that this function is
> responsible to convert managed strings into a native encoding.
>
> Can someone provide some help on this? Any help would be much appreciated.
>
> I can provide more detailed info if necessary.
>
> Thanks.
> Qpid.User.2!
>
>    
QU2,

This has been seen before (see this thread on dev: 
http://mail-archives.apache.org/mod_mbox/qpid-dev/201009.mbox/browser).

-Ted


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


Re: Issue with C# binding libraries

Posted by Ted Ross <tr...@redhat.com>.
On 10/01/2010 01:10 PM, qpid user 2 wrote:
> Hi folks,
>
> I am having an issue with C# binding dll when trying to connect to the
> broker. This issue only happens in Release mode. I get an exception when
> trying to instantiate a Connection object and pass on a connection url to
> target the broker. the original exception is AccessViolationException:
> "Attempted to read or write protected memory. This is often an indication
> that other memory is corrupt.". and it happens in Connection.cpp when
> QpidMarshal::ToNative(url) returns. I am assuming that this function is
> responsible to convert managed strings into a native encoding.
>
> Can someone provide some help on this? Any help would be much appreciated.
>
> I can provide more detailed info if necessary.
>
> Thanks.
> Qpid.User.2!
>
>    
QU2,

This has been seen before (see this thread on dev: 
http://mail-archives.apache.org/mod_mbox/qpid-dev/201009.mbox/browser).

-Ted


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org