Peot Absent Member.
Absent Member.
5219 views

Hanging Garbage Collection in C#

Hello,

we've stumbled upon an odd behavior at one of our customers:

During a C# program accessing the GroupWise Object Store through the
Groupwise Object API, we trigger the Garbagabe collection with the
instruction:

"GC.GetTotalMemory(true);"


If we do not do that, our program runs into the following exception
after a time:

"System.AccessViolationException: Attempted to read or write protected
memory. This is often an indication that other memory is corrupt.
at System.RuntimeType.ForwardCallToInvokeMember(String memberName,
BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&
msgData)
at GroupwareTypeLibrary.DIGWAccount6.get_AllFolders()
at
com.vivex.update.groupware.GroupWise.GroupWiseInterfaces.OAPIGroupWise.GetMessages(DateTime
modified, GroupWiseRetrievalSettings settings) in
E:\Projekte\update.groupware for GroupWise\update.groupware for
groupwise\GroupWise.cs:Zeile 2805.
at
com.vivex.update.groupware.GroupWise.Synchronizer.SyncMessages(User
user, GroupWiseRetrievalSettings settings, DateTime lastRetentionDate,
DateTime nextRetentionDate, DateTime lastSyncDate, DateTime
nextSyncDate) in E:\Projekte\update.groupware for
GroupWise\update.groupware for groupwise\Synchronizer.cs:Zeile 584.


Now at our customer's, this instruction does not return. This occurs on
differing machines, all running DotNet 2.0.50727, which we also run on
our test environment, where this behavior is unheard of.

Has anyone else ever encountered a similar problem?

Thanks for the help.

Best regards, Martin Schmidt.
Labels (1)
0 Likes
3 Replies
Anonymous_User Absent Member.
Absent Member.

Re: Hanging Garbage Collection in C#

Yup, that sounds veeery familiar for me ;-((
Had the same problem on NET 3.5 + GW 8.0.0 HP1 client.
Although we did try all possible things to secure terminate the GW COM objects
(Marshal.ReleaseComObjet, Gc.Collect,...) we couldn't solve that problem.
Seems as I some COM objects won't get released inernal. We had the most probs with
getting messages from a proxy account.

In the end we switched to SOAP, which was quite a redesign of the app on the one hand
and some things can't be done with SOAP so far.....

Markus



"Martin Schmidt" <Martin.Schmidt@schiffl-vivex.de> schrieb im Newsbeitrag
news:%fdTl.3127$rb5.694@kovat.provo.novell.com...
> Hello,
>
> we've stumbled upon an odd behavior at one of our customers:
>
> During a C# program accessing the GroupWise Object Store through the Groupwise
> Object API, we trigger the Garbagabe collection with the instruction:
>
> "GC.GetTotalMemory(true);"
>
>
> If we do not do that, our program runs into the following exception after a time:
>
> "System.AccessViolationException: Attempted to read or write protected memory. This
> is often an indication that other memory is corrupt.
> at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags
> flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
> at GroupwareTypeLibrary.DIGWAccount6.get_AllFolders()
> at
> com.vivex.update.groupware.GroupWise.GroupWiseInterfaces.OAPIGroupWise.GetMessages(DateTime
> modified, GroupWiseRetrievalSettings settings) in E:\Projekte\update.groupware for
> GroupWise\update.groupware for groupwise\GroupWise.cs:Zeile 2805.
> at com.vivex.update.groupware.GroupWise.Synchronizer.SyncMessages(User user,
> GroupWiseRetrievalSettings settings, DateTime lastRetentionDate, DateTime
> nextRetentionDate, DateTime lastSyncDate, DateTime nextSyncDate) in
> E:\Projekte\update.groupware for GroupWise\update.groupware for
> groupwise\Synchronizer.cs:Zeile 584.
>
>
> Now at our customer's, this instruction does not return. This occurs on differing
> machines, all running DotNet 2.0.50727, which we also run on our test environment,
> where this behavior is unheard of.
>
> Has anyone else ever encountered a similar problem?
>
> Thanks for the help.
>
> Best regards, Martin Schmidt.



0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Hanging Garbage Collection in C#

Thanks for sharing...

I use the GroupWise object API from JavaScript. This is also seems to have
the same issues with garbage collection of COM objects as .Net

I have been trying to figure out the cause of frequent Access Violation
exceptions and the reference to the Account.get_AllFolders() property in
your error message gives me a new line of enquiry.

Have you seen any other specific GW API methods/properties that cause Access
Violations?


Dave M


0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Hanging Garbage Collection in C#

The Object API has always been very sensitive to objects
not being released.
To try to find out if the objects are being released, watch
the "App Connections:" count on the POA. Make sure when you
release the objects, that the count decrements by one.

If possible don't use the Application.Login method, but use
the Application.MultiLogin method and turn off the MAPI
address book support: Application.MultiLoginAddressBookSupport
= TRUE. MAPI does a reference count on an internal object.
I've haven't figured out how to get the reference released.

Be careful of referencing multiple objects in one command.
Set gwMessage = gwMailbox.Messages.Add("GW.MESSAGE.MAIL")
Instead write it as:
Set gwMessages = gwMailbox.Messages
Set gwMessage = gwMessages.Add("GW.MESSAGE.MAIL")
Set gwMessages = Nothing

Be sure to release objects as soon as you are done with them.

Preston

>>> On Thursday, May 28, 2009 at 12:45 PM, Dave M<davem@yaletech.com>

wrote:
> Thanks for sharing...
>
> I use the GroupWise object API from JavaScript. This is also seems to

have
> the same issues with garbage collection of COM objects as .Net
>
> I have been trying to figure out the cause of frequent Access Violation
> exceptions and the reference to the Account.get_AllFolders() property in
> your error message gives me a new line of enquiry.
>
> Have you seen any other specific GW API methods/properties that cause

Access
>
> Violations?
>
>
> Dave M

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.