"A heap has been corrupted" in AddressMap.FindNextAddressMap

mcbsys
Posts: 36
Joined: Wed Jan 04, 2006 10:19 pm

"A heap has been corrupted" in AddressMap.FindNextAddressMap

Postby mcbsys » Thu Dec 16, 2010 6:08 am

Hi,

I've been working on a web app to do some basic ME user and group administration tasks.

I'm using the .NET API in MailEnable.Admin.dll, file version 1.0.2447.28179 dated 9/13/2006--is that current?

When I deploy this to a Windows Server 2008 R2 machine running IIS7 and MailEnable Standard 4.25, the IIS worker process hosting my app always crashes, sometimes right away, sometimes after a minute or two.

I've been working with WinDbg and have seen at least two instances where the crash is in MailEnable.Administration.AddressMap.FindNextAddressMap().

I'll put a code snippet and dump in separate posts.

Any idea what the problem is here? Am I calling the procedure correctly?

Thanks,

Mark Berry
MCB Systems

mcbsys
Posts: 36
Joined: Wed Jan 04, 2006 10:19 pm

Re: "A heap has been corrupted" in AddressMap.FindNextAddressMap

Postby mcbsys » Thu Dec 16, 2010 6:13 am

Part of the WinDbg output. Notice the last call on managed stack trace.
-------------------------------------------------------------------
0:024> !analyze -v
[...snip...]

FAULTING_IP:
ntdll!RtlpNtEnumerateSubKey+1b26
77b9dc9b eb12 jmp ntdll!RtlpNtEnumerateSubKey+0x1b3a (77b9dcaf)

EXCEPTION_RECORD: ffffffff -- (.exr 0xffffffffffffffff)
ExceptionAddress: 77b9dc9b (ntdll!RtlpNtEnumerateSubKey+0x00001b26)
ExceptionCode: c0000374
ExceptionFlags: 00000001
NumberParameters: 1
Parameter[0]: 77bd4268

DEFAULT_BUCKET_ID: WRONG_SYMBOLS

PROCESS_NAME: w3wp.exe

ADDITIONAL_DEBUG_TEXT:
Use '!findthebuild' command to search for the target build information.
If the build information is available, run '!findthebuild -s ; .reload' to set symbol path and load symbols.

FAULTING_MODULE: 769e0000 kernel32

DEBUG_FLR_IMAGE_TIMESTAMP: 4bebd49a

MODULE_NAME: mscorwks

ERROR_CODE: (NTSTATUS) 0xc0000374 - A heap has been corrupted.

EXCEPTION_CODE: (NTSTATUS) 0xc0000374 - A heap has been corrupted.

EXCEPTION_PARAMETER1: 77bd4268
[...snip...]

0:024> k
ChildEBP RetAddr
WARNING: Stack unwind information not available. Following frames may be wrong.
10d6d974 77b77e3a ntdll!ZwWaitForSingleObject+0x15
10d6d9cc 77b9dc2e ntdll!RtlReportException+0x86
10d6d9e0 77b9dcab ntdll!RtlpNtEnumerateSubKey+0x1ab9
10d6dec4 77b9eba1 ntdll!RtlpNtEnumerateSubKey+0x1b36
10d6ded4 77b9ec81 ntdll!RtlpNtEnumerateSubKey+0x2a2c
10d6df08 77b9eeea ntdll!RtlpNtEnumerateSubKey+0x2b0c
10d6df60 77b59e41 ntdll!RtlpNtEnumerateSubKey+0x2d75
10d6df9c 77b0b604 ntdll!RtlUlonglongByteSwap+0xcc11
10d6dfcc 77b0b555 ntdll!RtlFormatCurrentUserKeyPath+0x60b
10d6e0ac 77b02eb0 ntdll!RtlFormatCurrentUserKeyPath+0x55c
10d6e130 748ca0bc ntdll!RtlInterlockedFlushSList+0x8db
10d6e16c 748ca13a mscorwks+0xa0bc
10d6e180 748cf296 mscorwks+0xa13a
10d6e1b4 748fd92b mscorwks!LogHelp_NoGuiOnAssert+0x321a
10d6e1c8 748fd9a6 mscorwks!CreateAssemblyNameObject+0xc940
10d6e1f4 748fda29 mscorwks!CreateAssemblyNameObject+0xc9bb
10d6e20c 748fda4d mscorwks!CreateAssemblyNameObject+0xca3e
10d6e21c 749a2599 mscorwks!CreateAssemblyNameObject+0xca62
10d6e230 74900f40 mscorwks!CorExitProcess+0x5a23
10d6e26c 74901b36 mscorwks!DllRegisterServerInternal+0x2a58
10d6e28c 7490176e mscorwks!DllRegisterServerInternal+0x364e
10d6e4d4 7490227c mscorwks!DllRegisterServerInternal+0x3286
10d6e56c 74902986 mscorwks!DllRegisterServerInternal+0x3d94
10d6e5b4 749029d1 mscorwks!DllRegisterServerInternal+0x449e
10d6e5ec 749029f4 mscorwks!DllRegisterServerInternal+0x44e9
10d6e638 748fede7 mscorwks!DllRegisterServerInternal+0x450c
10d6e690 748fddd8 mscorwks!DllRegisterServerInternal+0x8ff
10d6e6e4 748d13bb mscorwks!CreateAssemblyNameObject+0xcded
10d6e828 748d8cf2 mscorwks!LogHelp_NoGuiOnAssert+0x533f
10d6e82c 748d72b9 mscorwks!LogHelp_NoGuiOnAssert+0xcc76
10d6e858 748db584 mscorwks!LogHelp_NoGuiOnAssert+0xb23d
10d6e87c 00000000 mscorwks!LogHelp_NoGuiOnAssert+0xf508

0:024> !clrstack
PDB symbol for mscorwks.dll not loaded
OS Thread Id: 0x5b0 (24)
ESP EIP
10d6e764 77aef861 [PrestubMethodFrame: 10d6e764] MailEnable.Administration.AddressMap.AddressMapFindNext(IADDRESSMAPENTRYTYPE ByRef)
10d6e774 0f129aff MailEnable.Administration.AddressMap.FindNextAddressMap()
10d6e790 0f129a32 MCBSystems.MailEnableAdmin.Model.MailEnable_AddressMap.FindNextAddressMap(MCBSystems.MailEnableAdmin.Model.MailEnable_AddressMap)
10d6e7e4 0f12939f MCBSystems.MailEnableAdmin.Model.MailEnable_AddressMap.GetAddressMapListByMailboxName(System.String, System.String)
10d6e82c 0f128ca0 MCBSystems.MailEnableAdmin.Model.User.PopulateUserFromMailbox(MCBSystems.MailEnableAdmin.Model.User, Boolean)
10d6e984 0f126d44 MCBSystems.MailEnableAdmin.Model.User.GetUserList(System.String, StatusEnum, RedirectEnum, StatusEnum, Int32 ByRef, Int32 ByRef, Int32 ByRef, System.String)
10d6eb14 0f125f20 MCBSystems.MailEnableAdmin.Controls.UsersControl.LoadUsers(UserFilterEnum, System.String, System.String, Int32, Int32)
10d6ec14 0f1226cf MCBSystems.MailEnableAdmin.MainForm.LoadUsersControl()
10d6ec34 0f1225aa MCBSystems.MailEnableAdmin.MainForm.listBoxUsers_SelectedIndexChanged(System.Object, System.EventArgs)
10d6ec50 0f121a40 Gizmox.WebGUI.Forms.ListBox.OnSelectedIndexChanged(System.EventArgs)
10d6ec68 0f121980 Gizmox.WebGUI.Forms.ListBox.SelectIndexes(System.String)
10d6ec98 0f12161f Gizmox.WebGUI.Forms.ListBox.set_SelectedIndex(Int32)
10d6ecc0 0f122545 MCBSystems.MailEnableAdmin.MainForm.LoadUsersTab()
10d6ecd4 0f122344 MCBSystems.MailEnableAdmin.MainForm.navigationTabs1_SelectedIndexChanged(System.Object, System.EventArgs)
10d6ecf0 0e79b412 Gizmox.WebGUI.Forms.TabControl.OnSelectedIndexChanged(System.EventArgs)
10d6ed00 0e79aeee Gizmox.WebGUI.Forms.TabControl.set_SelectedIndex(Int32)
10d6ed1c 0e79f009 MCBSystems.MailEnableAdmin.MainForm.LoadPostofficesTab()
10d6ed48 0e79ee8c MCBSystems.MailEnableAdmin.MainForm.MainForm_Load(System.Object, System.EventArgs)
10d6ed5c 0e79ee12 Gizmox.WebGUI.Forms.Form.OnLoad(System.EventArgs)
10d6ed6c 0e79ed52 Gizmox.WebGUI.Forms.Form.OnCreateControl()
10d6ed94 0e79e477 Gizmox.WebGUI.Forms.Control.CreateControl(Boolean)
10d6edc4 0e79e2cf Gizmox.WebGUI.Forms.Control.SetVisibleCore(Boolean)
10d6edf4 0e79e09f Gizmox.WebGUI.Forms.Form.SetVisibleCore(Boolean)
10d6ee0c 0e79df89 Gizmox.WebGUI.Forms.Control.SetVisibleInternal(Boolean)
10d6ee18 0e79dec1 Gizmox.WebGUI.Forms.Form.SetVisibleInternal(Boolean)
10d6ee28 0e79de79 Gizmox.WebGUI.Forms.Control.set_Visible(Boolean)
10d6ee30 0e79de16 A.c4d3cdb893b7f640a5aa2a40bfe2211b1.ShowForm(Gizmox.WebGUI.Common.Interfaces.IForm, Gizmox.WebGUI.Hosting.HostContext)
10d6ee60 0e7902fd A.c4d3cdb893b7f640a5aa2a40bfe2211b1.ProcessRequest(Gizmox.WebGUI.Hosting.HostContext)
10d6ef30 01f233cb Gizmox.WebGUI.Hosting.HostHttpHandler.System.Web.IHttpHandler.ProcessRequest(System.Web.HttpContext)
10d6ef40 6f47f9e6 System.Web.HttpApplication+CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
10d6ef74 6f452a5c System.Web.HttpApplication.ExecuteStep(IExecutionStep, Boolean ByRef)
10d6efb4 6f45e1f3 System.Web.HttpApplication+ApplicationStepManager.ResumeSteps(System.Exception)
10d6f004 6f451fdc System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(System.Web.HttpContext, System.AsyncCallback, System.Object)
10d6f020 6f45554c System.Web.HttpRuntime.ProcessRequestInternal(System.Web.HttpWorkerRequest)
10d6f054 6f4551f3 System.Web.HttpRuntime.ProcessRequestNoDemand(System.Web.HttpWorkerRequest)
10d6f064 6f45438c System.Web.Hosting.ISAPIRuntime.ProcessRequest(IntPtr, Int32)
10d6f278 749e0256 [ContextTransitionFrame: 10d6f278]
10d6f2ac 749e0256 [GCFrame: 10d6f2ac]
10d6f408 749e0256 [ComMethodFrame: 10d6f408]
Last edited by mcbsys on Thu Dec 16, 2010 6:45 am, edited 1 time in total.

mcbsys
Posts: 36
Joined: Wed Jan 04, 2006 10:19 pm

Re: "A heap has been corrupted" in AddressMap.FindNextAddressMap

Postby mcbsys » Thu Dec 16, 2010 6:20 am

Here's my FindNextAddressMap function, which wraps the ME function. There's an almost identical wrapper for FindFirstAddressMap.

Code: Select all

        public static int FindNextAddressMap(MailEnable_AddressMap _addressMap)
        {
            MailEnable.Administration.AddressMap MEaddressMap = new MailEnable.Administration.AddressMap();
            MEaddressMap.Account = _addressMap.Account;
            MEaddressMap.SourceAddress = _addressMap.SourceAddress;
            MEaddressMap.DestinationAddress = _addressMap.DestinationAddress;
            MEaddressMap.Host = "";
            MEaddressMap.Scope = "";
            int iResult = MEaddressMap.FindNextAddressMap();  <== ABORTS WITH CORRUPT HEAP (MEMORY EXCEPTION)
            if (iResult == 1)
            {
                _addressMap.Account = MEaddressMap.Account;
                _addressMap.SourceAddress = MEaddressMap.SourceAddress;
                _addressMap.DestinationAddress = MEaddressMap.DestinationAddress;
                _addressMap.Host = MEaddressMap.Host;
                _addressMap.Scope = MEaddressMap.Scope;
            }
            return iResult;
        }

And here is my GetAddressMapListByMailboxName function that calls the above:

Code: Select all

        public static List<MailEnable_AddressMap> GetAddressMapListByMailboxName(string Postoffice, string MailboxName)
        {
            string strDestinationAddress = "[SF:" + Postoffice + "/" + MailboxName + "]";

            List<MailEnable_AddressMap> _addressMapList = new List<MailEnable_AddressMap>();
            MailEnable_AddressMap _addressMap = new MailEnable_AddressMap();
            _addressMap.Account = Postoffice;
            _addressMap.SourceAddress = "";
            _addressMap.DestinationAddress = strDestinationAddress;
            int iResult = MailEnable_AddressMap.FindFirstAddressMap(_addressMap);
            while (iResult==1)
            {
                _addressMapList.Add(_addressMap);

                _addressMap = new MailEnable_AddressMap();
                _addressMap.Account = Postoffice;
                _addressMap.SourceAddress = "";
                _addressMap.DestinationAddress = strDestinationAddress;
                iResult = MailEnable_AddressMap.FindNextAddressMap(_addressMap);
            }
            _addressMapList.Sort();
            return _addressMapList;
        }


Any suggestions/help much appreciated!

Mark Berry
MCB Systems

Admin
Site Admin
Posts: 785
Joined: Mon Jun 10, 2002 6:31 pm
Location: Melbourne, Victoria, Australia

Re: "A heap has been corrupted" in AddressMap.FindNextAddressMap

Postby Admin » Thu Dec 16, 2010 10:00 am

Hi,

For the Administration DLL, use the MailEnable.Administration.dll file which is installed in the Mail Enable\bin directory. This is the latest administration DLL (the other would only be needed if running older versions of MailEnable, or MailEnable Standard). Pro and Enterprise versions include this and the updated Store DLL MailEnable.Store.dll. If you get the same problem, please let me know and I will check further.

mcbsys
Posts: 36
Joined: Wed Jan 04, 2006 10:19 pm

Re: "A heap has been corrupted" in AddressMap.FindNextAddressMap

Postby mcbsys » Thu Dec 16, 2010 3:46 pm

Hi,

Thanks for the response.

As mentioned in the first post, I am working with MailEnable Standard 4.25. I do not see a MailEnable.Administration.dll file.

Are you saying the current API is only available with MailEnable Pro?

Mark Berry
MCB Systems

mcbsys
Posts: 36
Joined: Wed Jan 04, 2006 10:19 pm

Re: "A heap has been corrupted" in AddressMap.FindNextAddressMap

Postby mcbsys » Thu Dec 16, 2010 4:47 pm

Hi again,

As a test, I downloaded ME Pro 4.26 and did a temporary install to extract MailEnable.Administration.dll. In some brief initial testing, that does seem to resolve the issue (no crashes yet).

From page 3 of the API guide I gathered that I should not distribute ME components but that it is enough for ME Standard, Pro, or Enterprise to be installed. How do I get an API version that works with ME Standard 4.25+?

Thanks,

Mark Berry
MCB Systems

Admin
Site Admin
Posts: 785
Joined: Mon Jun 10, 2002 6:31 pm
Location: Melbourne, Victoria, Australia

Re: "A heap has been corrupted" in AddressMap.FindNextAddressMap

Postby Admin » Fri Dec 17, 2010 12:05 am

Hi,

We updated the developer resource page at the following URL with the administration assemblies for Standard.

http://www.mailenable.com/developer-resources.asp

If you want to redistribute these you would just need permission from us (which just involves emailing us at sales and telling us what you are doing).

Who is online

Users browsing this forum: No registered users and 1 guest