#243 80004005 Processing Outlook on busy system

Classes (182)

My REXX script processes a Microsoft Outlook folder. Randomly, I receive a syntax error trying to retrieve the body of an email. The dump of condition("O") is:

PROGRAM........C:\Documents and Settings\John Bodoh\my documents\imdb\testole.REX

MESSAGE........An unknown OLE error occured (HRESULT=80004005).

ADDITIONAL.....An Array:
TRACEBACK......A List:
23 - body = mail_obj~body;
ERRORTEXT......OLE error

Running the script repeatedly will result in errors on different records and a different count of records. But, it seems to always be when getting the body of the email.

After much testing, I discovered that the error occurred mostly when something else was going on on the system. While the script is running (the Outlook folder I process has over 900 emails and it takes awhile for the program to run), if I start some other program (e.g., Freecell) or interact with another program (e.g., scrolling an editor) the errors will begin occurring. My program handles the errors by putting out a messsage and skipping the email. When I caused some other activity on the system, I would usually get three or four errors in a row. Then, when the other activity settled down, the errors would no longer be occurring.

I have included a stripped down version of my program that will reproduce the errors. However, as I was developing the stripped down version, the more I stripped it down, the less the errors would occur.

Originally, I thought it was an error in Outlook. I reproduced the program in VB and tried it as an outlook macro. I could not get the failure with the VB.

The system I am running on is a Dell dual processor running Windows XP professional. I am running ooREXX version 3.1.0.


  • oorexxpert

    oorexxpert - 2007-03-08

    Test script

  • Mark Miesfeld

    Mark Miesfeld - 2007-03-08

    Logged In: YES
    Originator: NO


    Thanks for the detailed report. I'll work on this and see if I can find the root cause of the problem.

  • Mark Miesfeld

    Mark Miesfeld - 2007-03-08

    Logged In: YES
    Originator: NO


    Great test program in that it is easy to run on my system. Unfortunately, I do not get an error:

    E:\work.ooRexx\other\bugs.new\bug.1676463>testole Sent Items
    There were 0 in 402 mail items ( 0 percent).

    There were 0 in 987 mail items ( 0 percent).


    I think we also need to know the version of OutLook you are running. I have:

    Microsoft Office Outlook 2003 (11.8010.8036) SP 2
    Part of Microsoft Office Professional Edition 2003

    I'll try this on another system I have that has a slightly different version of OutLook and also see if I can build up a folder with more e-mails in it.

  • oorexxpert

    oorexxpert - 2007-03-08

    Logged In: YES
    Originator: YES

    I am using Outlook 2003 (11.6568.6568) SP2.

    When trying to reproduce the error don't forget to try to cause other activity on the system.

    I don't know if it matters but my computer is a dual processor machine. Also, the average size of the body of the emails being processes is about 28k.

  • Mark Miesfeld

    Mark Miesfeld - 2007-03-08

    Logged In: YES
    Originator: NO

    I haven't been able to reproduce this yet, and I have tried a lot.

    There were 0 errors in 7659 mail items ( 0 percent).
    Start time: 09:15:57 elapsed time: 238.854000

    On this system, I used a mail folder that has 7,659 items. Average size is closer to 14 KB, but there are a lot of messages with bigger sizes, 80, 90 120 KB. This particular execution took almost 6 minutes. During that time I opened and shut the MSDN Library, various PDF files, InterNet Explorer, SlickEdit. All of which use a lot of system resources opening and closing. I also spent almost a minute continuously moving the scrollbars in SlickEdit. I also opened and shut the TaskManager, another thing that uses a lot of system resources.

    1.) It might be useful for you to capture the subject line when you get an error on an e-mail body. Maybe there is some pattern on which e-mails cause the problem.

    2.) Under: All Programs -> Acessories -> System Tools there is the System Information application. On my systems it lists: Office 2003 Applications. In that category, under Outlook it has a section titled COM Add-ins. The information I have is:

    Add-Ins 1
    Name Microsoft VBA for Outlook Addin
    Installed Yes
    GUID {799ED9EA-FB5E-11D1-B7D6-00C04FC2AAE2}

    Can you check and see if your system is similar, or different?

    Also, note this. The error itself is coming from Outlook. OLEObject has an IDispatch pointer to the Outlook email object and invokes the body method. The Outlook email object then returns the body. In the error case you see, instead of returning the body, Outlook returns an error code.

    The error code does not come from ooRexx, the error code is sent by Outlook. ooRexx is just reporting back what Outlook returned.

    I'll continue investigating this. I'll try doing some type of processing with the e-mail body. When you said you simplified the program, what types of things did you take out? Maybe if I add something like that back in ...

  • Mark Miesfeld

    Mark Miesfeld - 2007-04-20

    Logged In: YES
    Originator: NO


    I do not believe that this is an OLEObject bug. It is Outlook that is replying to an IDispatch method invocation with an OLE error return code. The OLEObject is just reporting back, correctly, what it gets from Outlook. I have tried on 6 different systems with several different versions of Outlook, for some time, and have never once gotten this error.

    Based on that, and several of the conversations we had in e-mail, I am marking this as invalid and putting it in the pending status. If you agree with my conclusion you should change the status to closed.

    From one of our e-mails:

    I tried it here on my work PC and I could not get it to fail yet. One thing
    I did notice is that at work here with lots of other applications running,
    it would process about 18 mails per second. On my home PC, which is a
    faster machine, it couldn't do more that two or three records per second.
    Hmmmmm. That tells me that there must be something very wrong with my home
    PC and why I can't reproduce it here at work and why you can't reproduce it.

  • Nobody/Anonymous

    Logged In: NO

    I am still having the problem. I am building several test cases to try to determine either what is causing the problem or a way around it:

    1. Open folder; read sequentially using GETNEXT.

    2. Open folder; get list of subjects; sequentially process each subject using FIND.

    3. Open folder; get list of subjects; sequentially open and find each subject.

    I believe that the cause of the problem is either some option or setup that I have made that is causing the problem on my PC or there is a bug processing REXX on a dual core processor with hyperthreading (whatever that is). I will try to disable one of the processors to see if that corrects the problem. Nobody who has tried to recreate this problem has said they tried on a dual core processor.

    The 80004005 error code I get seems to be a general purpose catchall code that is absolutely useless. You might as well just say it's broke. Many of the other conditions on the web talk about messages being issued describing the reason for the 80004005. I receive no such message. Is it possible to turn on some flag somewhere that would cause messages to be generated? Is there anymore information that is returned by Outlook of available through Outlook that REXX doesn't pass on nor obtain from Outlook?

    As soon as I conduct my testcases, I will report it here.

  • Mark Miesfeld

    Mark Miesfeld - 2007-04-21

    Logged In: YES
    Originator: NO


    Two of the systems that I used to try and reproduce this on are Intel dual core systems. The OS sees this as two distinct CPUs. One of the systems I used to try and reproduce this is a true dual processor server, it has two seperate hyper-threaded Xeon CPUs. The OS sees that as 4 distinct CPUs

    As to the 80004005 error code, you have to blame Outlook for this not ooRexx.

    The define for 80004005 is E_FAIL, the message text for it is "Unspecified error."

    In OLE Automation, it is possible for the COM object (Outlook in this case) to return a HRESULT of DISP_E_EXCEPTION (80020009.) When a COM object returns this error code, the COM object can also fill in a structure with additional error information. However, the only thing the COM object is required to fill in is an error code.

    1.) If the OLEObject gets this error when IDispatch::Invoke is used, all the informtion in the additional error structure is processed and added to the ooRexx error message.

    2.) Since I can not reproduce the error, I do not know if Outlook is returning E_ FAIL (80004005) or DISP_E_EXCEPTION (80020009,) but I do know this: if Outlook is returning DISP_E_EXCEPTION, the only additional information it is returning is the error code E_FAIL.

    So, you have to blame MicroSoft Outlook for the "absolutely useless" error code, not ooRexx.

    I have no problem putting this back into the open state if you still think this is truely an OLEObject bug. However, I also see absolutely no indication that it is an OLEObject bug. <grin>

  • Mark Miesfeld

    Mark Miesfeld - 2008-07-18

    Logged In: YES
    Originator: NO

    There is nothing OLEObject is doing wrong here. It is not an ooRexx bug, it is an OutLook bug.

    I've ran the test program on a half a dozen systems, dozens of times, with folders that have 6 to 7 thousand e-mails in them. Without once having an error as John reported.

    OLEObject merely invokes a method through IDispatch. The parameters to the invocation are exactly the same every time. It is up to OutLook to reply to the invocation. The fact that the invocation succeeds thousand's of times shows that the set up of the invocation is correct. Something is going on inside of Outlook that causes Outlook to return an error code. There is nothing that ooRexx can do except report back what Outlook returned.



Cancel  Add attachments