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 » MQQueueManager instance gets protected memory error

Post new topic  Reply to topic
 MQQueueManager instance gets protected memory error « View previous topic :: View next topic » 
Author Message
fraeliz
PostPosted: Wed Aug 24, 2011 8:36 am    Post subject: MQQueueManager instance gets protected memory error Reply with quote

Newbie

Joined: 24 Aug 2011
Posts: 2

I have been working on this issue for quite a few days and need help.
I am trying to connect to queue manager using vb.net (VS 2008 framework 3.5). When creating instance/connecting to queue manager I am getting the error "Attempted to read or write protected memory. This is often an indication that other memory is corrupt. "

My string is coming from a dataset. If i 'hardcode' the mq manager name to a string I don't get the error. If I assign the string from a dataset or datareader item. I get the error.

Note the error is not thrown in the MQ exception block, but the normal .net exception
Pertinent code is as follows:
Code:
   Dim mqQMgr As MQQueueManager            '* MQQueueManager instance
        Dim mqQueue As MQQueue                  '* MQQueue instance
        Dim mqMsg As MQMessage                  '* MQMessage instance
        Dim mqPutMsgOpts As MQPutMessageOptions '* MQPutMessageOptions instance
        Dim boolQueueInfoExist As Boolean = True
        Dim strExceptionMessage As String = ""
        Dim strQueueName As String = ""
        Dim intExpirationTime As Integer = 0
        Dim strQueueMgr As String = ""
        Dim strCommand As String = ""
        Dim dsRequest As New DataSet

   
        Try
           
            strCommand = "SELECT mbeq.MSG_QUEUE_NAME, mbeq.MSG_QUEUE_MGR,mbeq.EXPIRATION_TIME "
            strCommand = String.Concat(strCommand, " FROM " & STR_CONFIG_DB & ".dbo.trgt_mbe_queue_info mbeq")
            strCommand = String.Concat(strCommand, " WHERE mbeq.PZAP_APP_ID = " + "'" + pstrAppId + "'")
            strCommand = String.Concat(strCommand, " AND mbeq.PZAP_APP_ID_XCOM = " + "'" + pstrXcomId + "'")

            dsRequest = m_objDbConn.ExecuteDataSet(strCommand)

            strQueueMgr = CType(dsRequest.Tables(0).Rows(0).Item(1), String)
            strQueueName = CType(dsRequest.Tables(0).Rows(0).Item(0), String)
            intExpirationTime = CInt(dsRequest.Tables(0).Rows(0).Item(2))
           
            If (strQueueMgr.Length > 0) Then
                '* queue manager name provided
 
                mqQMgr = New MQQueueManager(strQueueMgr)
 
            Else
                '* queue manage name not provided - use default queue manager
                mqQMgr = New MQQueueManager()
            End If


        Catch mqe As IBM.WMQ.MQException
            If m_strAppId <> "EADJ" And m_strAppId <> "EADM" Then
                MsgBox("Unable to instantiate MQQueueManager instance named: " & strQueueMgr)
                MsgBox("Mqe.Message = " & mqe.Message)
            End If

            Throw mqe

        Catch objException As Exception

            dsRequest = Nothing
       
            Throw objException

        End Try
Back to top
View user's profile Send private message
muthum_2000
PostPosted: Tue Sep 27, 2011 8:55 am    Post subject: Reply with quote

Voyager

Joined: 10 Jul 2006
Posts: 85

Try to bring down MQ and clear all the semaphores related to mqm.

Then try bringing up the MQ manager and check if your app works.
Back to top
View user's profile Send private message
exerk
PostPosted: Tue Sep 27, 2011 9:11 am    Post subject: Reply with quote

Jedi Council

Joined: 02 Nov 2006
Posts: 6339

Also search this site. I think something like this came up in the recent past.
_________________
It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Sep 27, 2011 9:12 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

I suspect your code is causing a pointer to the field in the result set to be passed in to the MQQueueManager constructor, rather than a copy of the string data in the field in the result set.
Back to top
View user's profile Send private message
fraeliz
PostPosted: Tue Sep 27, 2011 9:48 am    Post subject: Reply with quote

Newbie

Joined: 24 Aug 2011
Posts: 2

I don't see a website in the post that refers to one.

For other post on 'pointer', so in this case it does become a .net odbc result set type question.

How does one convert from a 'pointer' type of reference to an actual copy of the string. It's not being passed as a parameter so not a matter of byref or byval type thing.
Back to top
View user's profile Send private message
ankurlodhi
PostPosted: Tue Sep 27, 2011 10:31 am    Post subject: Reply with quote

Master

Joined: 19 Oct 2010
Posts: 266

the looks ok. it can be possible that variable you are trying to write is private, or something like that give a try with checking the excess permissions a have scene these kind of errors when i was working on .net.


but its only a guess work from me. u might be missiong something.
Back to top
View user's profile Send private message
gbaddeley
PostPosted: Tue Sep 27, 2011 5:02 pm    Post subject: Reply with quote

Jedi

Joined: 25 Mar 2003
Posts: 2495
Location: Melbourne, Australia

Quote:
My string is coming from a dataset. If i 'hardcode' the mq manager name to a string I don't get the error. If I assign the string from a dataset or datareader item. I get the error.


MQCONN / New MQQueueManager in VB & VB.net seems to be a bit quirky about where the queue manager name comes from. I suggest using a global string variable.
_________________
Glenn
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 » MQQueueManager instance gets protected memory error
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.