ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » General IBM MQ Support » .NET error : Attempted to read or write protected memory ...

Post new topic  Reply to topic
 .NET error : Attempted to read or write protected memory ... « View previous topic :: View next topic » 
Author Message
desmetk
PostPosted: Mon Apr 23, 2007 5:11 am    Post subject: .NET error : Attempted to read or write protected memory ... Reply with quote

Newbie

Joined: 23 Apr 2007
Posts: 4

Hello,

Im not sure if this is the correct place to post this issue but anyway ...
Some background :
We're implementing an application that is using MQ client to connect to a remote queue manager. We where able to get it to work but after sending some messages to the remote machine we get the next message and the application is hanging:

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

We are using VB.NET and this is the code fragment where we could reproduce the error with ! Does anyone has an idea what is going on?

Thanks in advance,

Public Sub SendMessage()
Dim QMgr As MQQueueManager
Dim OutputQueue As MQQueue
Dim mqMsg As MQMessage
Dim mqPutOptions As MQPutMessageOptions

MQEnvironment.Hostname = _host
MQEnvironment.Channel = _channel

QMgr = New MQQueueManager(_broker)

Dim OutOptions As Integer
OutOptions = MQC.MQOO_OUTPUT Or MQC.MQOO_FAIL_IF_QUIESCING

OutputQueue = QMgr.AccessQueue(_queue, OutOptions)

mqMsg = New MQMessage
mqMsg.Persistence = 1
mqMsg.MessageType = MQC.MQMT_DATAGRAM
mqMsg.Format = MQC.MQFMT_STRING
mqMsg.WriteChars(_message)
mqPutOptions = New MQPutMessageOptions
' Send the message
OutputQueue.Put(mqMsg, mqPutOptions)

QMgr.Disconnect()
QMgr.Close()

OutputQueue.Close()

QMgr = Nothing
OutputQueue = Nothing
mqMsg = Nothing
mqPutOptions = Nothing


End Sub
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Apr 23, 2007 5:32 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

What version of MQ are you using?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
yortch
PostPosted: Mon Apr 23, 2007 5:52 am    Post subject: Reply with quote

Apprentice

Joined: 30 Aug 2004
Posts: 34

Not sure if this is what's causing your problem, but you should close the queue before disconnecting from the queue manager.
Back to top
View user's profile Send private message
desmetk
PostPosted: Mon Apr 23, 2007 6:25 am    Post subject: Version MQ Reply with quote

Newbie

Joined: 23 Apr 2007
Posts: 4

The version we are using is 5.3
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Apr 23, 2007 6:32 am    Post subject: Re: Version MQ Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

desmetk wrote:
The version we are using is 5.3


Patched to which level??

And yortch is right, you should close the queue before you disconnect from queue manager. After you disconnect, close is impossible. It should fail gracefully, but under earlier versions this may not be the case.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
desmetk
PostPosted: Mon Apr 23, 2007 6:37 am    Post subject: Reply with quote

Newbie

Joined: 23 Apr 2007
Posts: 4

Currently no patches applied, we where looking onto the site of IBM and found out that there is a patch 6 where a problem is fixed that might be related to ours?

It is possible that there where patches linked to our installation, can you tell me where to look for the type of patches applied?

btw, I have closed before disconnecting and have the same problem.

Thanks,
Kurt
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Apr 23, 2007 6:48 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

If you're on v5.3 with no patches applied I'm not surprised you're having problems!!

Never mind 6 which is as old as the hills, go to the latest level (CSD12) and try it again.

Patches have no type, they are supplied as CSDs.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Apr 23, 2007 6:50 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

desmetk wrote:
btw, I have closed before disconnecting and have the same problem.


Fair point, but it would still never work the other way round. You need an active connection to close the queue over.

I'd give up on further code changes until you've got to a stable level of MQ.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
yortch
PostPosted: Mon Apr 23, 2007 7:24 am    Post subject: Reply with quote

Apprentice

Joined: 30 Aug 2004
Posts: 34

Quote:
We where able to get it to work but after sending some messages to the remote machine we get the next message


Are you still able to get it to work?
Which line of code is this exception thrown?
Do you see any errors logged on the windows event log on the server where MQ is running?
Are you using .NET 2.0/VS2005 by any chance? I've found several posts where this occurs on .NET 2.0 apps (not using MQ)
Back to top
View user's profile Send private message
kevinf2349
PostPosted: Mon Apr 23, 2007 5:05 pm    Post subject: Reply with quote

Grand Master

Joined: 28 Feb 2003
Posts: 1311
Location: USA

I thought .Net support only came along with CSD7? Or was that only when it started working well enough to use?
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Apr 23, 2007 11:49 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

kevinf2349 wrote:
I thought .Net support only came along with CSD7? Or was that only when it started working well enough to use?


Either way, I wouldn't use anything much below CSD 10 with any level of confidence.....

For anything
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
ashu
PostPosted: Tue Apr 24, 2007 3:50 am    Post subject: Reply with quote

Centurion

Joined: 11 Nov 2006
Posts: 132

Code:
QMgr.Disconnect()
QMgr.Close()

OutputQueue.Close()



??????
Back to top
View user's profile Send private message
desmetk
PostPosted: Tue Apr 24, 2007 4:00 am    Post subject: Reply with quote

Newbie

Joined: 23 Apr 2007
Posts: 4

Hello,

Thanks all for your kind input, we have installed CDS13 and now the problems are solved. I would like to thank all of you agian to point us into the right direction.

Kurt
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Apr 24, 2007 5:29 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

ashu wrote:
Code:
QMgr.Disconnect()
QMgr.Close()

OutputQueue.Close()



??????


As yorch correctly drew our attention to further up the post....
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General IBM MQ Support » .NET error : Attempted to read or write protected memory ...
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.