none
Outlook is hanging on lock and unlock of computer RRS feed

  • Question

  • Hi,

    We have developed one plug-in for outlook. in this plug-in, one thread is keep running in background for life time of plug-in and wait for various event raised by our main thread in plug-in. Implementation of worker thread is as below :--

    void BackgroundTaskManager::onDoWork(System::Object^ sender, DoWorkEventArgs^ e)
    {
        try
        {
            while (e->Cancel == false)
            {
                mRemoveList->Clear();
                for each(KeyValuePair<uint64_t, BackgroundTask^>^ task in mTasks)
                {
                    task->Value->checkStarted();

                    if (task->Value->isComplete)
                    {
                        mRemoveList->Add(task->Key);
                    }
                }

                for each(uint64_t taskID in mRemoveList)
                {
                    mTasks->Remove(taskID);
                    DarkEventLog::Debug(String::Format("Completed task removed. {0}", taskID));
                }
                Sleep(1000);
                if (DarkClientManager::instance->isRunning == false)
                    break;
            }
        }
        catch (System::Exception^ ex)
        {
            throw ex;
        }
    }

    Now it is working fine in normal course. But if I leave my outlook running and lock system and after some time unlock the system, outlook becomes unresponsive. As it is background thread and not doing any UX update, I am not expecting outlook to be unresponsive because of that.

    Can somebody please suggest what could be the possible reason ?

    Thanks

    Dev

    Saturday, December 22, 2018 8:58 AM

All replies

  • Can you reproduce the problem under debugger? Can you see the threads and their call stacks?

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Wednesday, December 26, 2018 4:59 AM
  • Hi,

    I am sorry for late reply but now on further analysis, we have found that we are facing this issue while using our plug-in with cisco webex and citrix plug-in. So it could be combination of 3 plug-ins, which is causing us hang issue. Because of that, I have following doubts in my mind :---

    1- Is there any way to define the order of loading of plug-in ? In registry settings (HKCU / software / Microsoft / Office / AddIns) plugins are available in alphabetical order. Does it has any relation with order of loading of plug-ins.

    2- Did Microsoft outlook ensures ordering in firing of events also (theoretically or practically) ? Is there any way we could define that if 2 plug-ins are registered for same event (lets say send event), then who will get first for send event ?

    3- Does outlook ensures thread safety for event handlers ?- that means if a send event is handled by one one plug-In then, it will not raise event for other plug-in until first plug-in will finish their job.

    4- Does outlook ensure atomicity of mail object if above condition (3rd point) is not satisfied. That means if 2 plug-in are handling the send event, and thats why working on same mail object, they will not end up in modifying same copy. Either it will have first plug-in's modification or second one's modification ?

    Thanks

    Dev

    Thursday, January 31, 2019 7:43 AM
  • 1. No

    2. No

    3. Yes - all events are raised on the main Outlook thread, so there are never any concurrency issues.

    4. No. Both handlers end up modifying the same instance of the message.

    You really need to re architect your add if you depend on the order of the events or move your processing to a different event.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Thursday, January 31, 2019 4:06 PM