Problem with OnDatabaseChange

2 views
Skip to first unread message

Rocco

unread,
Jul 4, 2008, 11:36:31 AM7/4/08
to Nektra OEAPI Support
Hi

I'm having a strange behaviour in my OE plugin; I use OnDatabaseChange
event for getting notified when a new email arrives but I've noticed
that after the first 7-8 new email arrives, the OnDatabaseChange
events seems not to fire anymore.

I use this code inside the event:

If dt = tagOE_DATABASE_TRANSACTION.OE_TR_INSERT_MESSAGE Then
Dim NewMessage As IdMessaggio
NewMessage.FolderId = folderId
NewMessage.MessageId = objId
Dim NewMsgHandler As New System.Threading.Thread(AddressOf
ProcessNewMessage)
NewMsgHandler.Start(NewMessage)
Endif

As you can see, I use a separate thread for checking each new email
(it's an anti-spam application); I did not find any better method not
to "miss" any new email while doing all the checks.
In an old post you said: "Try not creating a "new" thread for each
message, just use a single thread
that read the incoming messages from a list."
But how can build/read this list? How can I know if a mail is a new-
just-arrived email?

Also, when I move more than 7-8 emails at a time from folder A to
folder B and then click to folder B, OE crashes. This happens only
when my plugin is loaded.

My app is a VB.NET 2005 dll plugin build with VS 2005 PRO SP1
Using OEAPI Enterprise 3.2.2 on WinXP Pro SP3 with OE6

Thank you.

Nektra OEAPI Support

unread,
Jul 7, 2008, 1:01:44 PM7/7/08
to Nektra...@googlegroups.com
Hi Rocco,

We have verified incorrect behavior on the OnDatabaseChange event. We
will need time to make research on this issue.
By listing new incoming emails we meant to create an array and adding
the new messages to it, to process the messages that were added to the
array afterwards.

Thank you for your reports.

Regards,

Federico


--
Nektra Advanced Computing
http://www.nektra.com

Rocco

unread,
Jul 8, 2008, 3:22:29 AM7/8/08
to Nektra OEAPI Support
Hi

Can you tell me if this problem is present in the previous 3.2.1
version too?

This incorrect behavior is relative to the event not firing after a
few mails or to the crash when moving mails?

About the method of making an array of new messages without using
separate threads, how can I
make sure that I did not miss any new message coming while updating
the array?


Thank you.

On 7 Lug, 19:01, Nektra OEAPI Support <oeapi-supp...@nektra.com>
wrote:
> Nektra Advanced Computinghttp://www.nektra.com- Nascondi testo citato
>
> - Mostra testo citato

Nektra OEAPI Support

unread,
Jul 10, 2008, 4:26:16 PM7/10/08
to Nektra...@googlegroups.com
Hi again Rocco:

We have not reproduced this behavior on v3.2.1.

The problem seems is related to an error on the internal behavior OnDatabaseChange event.

Correctly updating the messages array is something you would have to work on.
In VB.NET it seems you need to use the SyncLock statement to lock the array while reading and while updating it, this way the array is protected from being modified from another thread while it's being read, and it's not read while it's being modified.
Also you would have to make sure the application waits for your thread to end  before exiting, else the process won't be terminated.

Thank you for contacting Nektra's OEAPI Support.

Rocco

unread,
Jul 14, 2008, 5:18:27 AM7/14/08
to Nektra OEAPI Support
Any news about this issue?
Please let me know ASAP when an update is available.



On 10 Lug, 22:26, Nektra OEAPI Support <oeapi-supp...@nektra.com>
wrote:
> Hi again Rocco:
> We have not reproduced this behavior on v3.2.1.
> The problem seems is related to an error on the internal behavior OnDatabaseChange event.
> Correctly updating the messages array is something you would have to work on.
> In VB.NET it seems you need to use theSyncLockstatement to lock the array while reading and while updating it, this way the array is protected from being modified from another thread while it's being read, and it's not read while it's being modified.
> Also you would have to make sure the application waits for your thread to end  before exiting, else the process won't be terminated.
> Thank you for contacting Nektra's OEAPI Support.
> Regards,
> Federico
> Rocco wrote:Hi Can you tell me if this problem is present in the previous 3.2.1 version too? This incorrect behavior is relative to the event not firing after a few mails or to the crash when moving mails? About the method of making an array of new messages without using separate threads, how can I make sure that I did not miss any new message coming while updating the array? Thank you. On 7 Lug, 19:01, Nektra OEAPI Support<oeapi-supp...@nektra.com>wrote:Hi Rocco, We have verified incorrect behavior on the OnDatabaseChange event. We will need time to make research on this issue. By listing new incoming emails we meant to create an array and adding the new messages to it, to process the messages that were added to the array afterwards. Thank you for your reports. Regards, Federico Rocco wrote:HiI'm having a strange behaviour in my OE plugin; I use OnDatabaseChange event for getting notified when a new email arrives but I've noticed that after the first 7-8 new email arrives, the OnDatabaseChange events seems not to fire anymore.I use this code inside the event:If dt = tagOE_DATABASE_TRANSACTION.OE_TR_INSERT_MESSAGE Then     Dim NewMessage As IdMessaggio     NewMessage.FolderId = folderId     NewMessage.MessageId = objId     Dim NewMsgHandler As New System.Threading.Thread(AddressOf ProcessNewMessage)     NewMsgHandler.Start(NewMessage) EndifAs you can see, I use a separate thread for checking each new email (it's an anti-spam application); I did not find any better method not to "miss" any new email while doing all the checks. In an old post you said: "Try not creating a "new" thread for each message, just use a single thread that read the incoming messages from a list." But how can build/read this list? How can I know if a mail is a new- just-arrived email?Also, when I move more than 7-8 emails at a time from folder A to folder B and then click to folder B, OE crashes. This happens only when my plugin is loaded.My app is a VB.NET 2005 dll plugin build with VS 2005 PRO SP1 Using OEAPI Enterprise 3.2.2 on WinXP Pro SP3 with OE6Thank you.-- Nektra Advanced Computinghttp://www.nektra.com- Nascondi testo citato - Mostra testo citato-- Nektra Advanced Computinghttp://www.nektra.com

Nektra OEAPI Support

unread,
Jul 16, 2008, 5:17:16 PM7/16/08
to Nektra...@googlegroups.com
Hi Rocco,

There are no news on this issue yet, it is still under research.
We will let you know as soon as there are news.


Thank you for contacting Nektra's OEAPI Support.

Regards,

Federico



Rocco wrote:
Any news about this issue?
Please let me know ASAP when an update is available.



On 10 Lug, 22:26, Nektra OEAPI Support <oeapi-supp...@nektra.com>
wrote:
  
Hi again Rocco:
We have not reproduced this behavior on v3.2.1.
The problem seems is related to an error on the internal behavior OnDatabaseChange event.
Correctly updating the messages array is something you would have to work on.
In VB.NET it seems you need to use theSyncLockstatement to lock the array while reading and while updating it, this way the array is protected from being modified from another thread while it's being read, and it's not read while it's being modified.
Also you would have to make sure the application waits for your thread to end  before exiting, else the process won't be terminated.
Thank you for contacting Nektra's OEAPI Support.
Regards,
Federico
Rocco wrote:Hi Can you tell me if this problem is present in the previous 3.2.1 version too? This incorrect behavior is relative to the event not firing after a few mails or to the crash when moving mails? About the method of making an array of new messages without using separate threads, how can I make sure that I did not miss any new message coming while updating the array? Thank you. On 7 Lug, 19:01, Nektra OEAPI Support<oeapi-supp...@nektra.com>wrote:Hi Rocco, We have verified incorrect behavior on the OnDatabaseChange event. We will need time to make research on this issue. By listing new incoming emails we meant to create an array and adding the new messages to it, to process the messages that were added to the array afterwards. Thank you for your reports. Regards, Federico Rocco wrote:HiI'm having a strange behaviour in my OE plugin; I use OnDatabaseChange event for getting notified when
 a new email arrives but I've noticed that after the first 7-8 new email arrives, the OnDatabaseChange events seems not to fire anymore.I use this code inside the event:If dt = tagOE_DATABASE_TRANSACTION.OE_TR_INSERT_MESSAGE Then     Dim NewMessage As IdMessaggio     NewMessage.FolderId = folderId     NewMessage.MessageId = objId     Dim NewMsgHandler As New System.Threading.Thread(AddressOf ProcessNewMessage)     NewMsgHandler.Start(NewMessage) EndifAs you can see, I use a separate thread for checking each new email (it's an anti-spam application); I did not find any better method not to "miss" any new email while doing all the checks. In an old post you said: "Try not creating a "new" thread for each message, just use a single thread that read the incoming messages from a list." But how can build/read this list? How can I know if a mail is a new- just-arrived email?Also, when I move more than 7-8 emails at a time from folder
 A to folder B and then click to folder B, OE crashes. This happens only when my plugin is loaded.My app is a VB.NET 2005 dll plugin build with VS 2005 PRO SP1 Using OEAPI Enterprise 3.2.2 on WinXP Pro SP3 with OE6Thank you.-- Nektra Advanced Computinghttp://www.nektra.com- Nascondi testo citato - Mostra testo citato-- Nektra Advanced Computinghttp://www.nektra.com
    

  


Rocco

unread,
Jul 25, 2008, 10:13:50 AM7/25/08
to Nektra OEAPI Support
I'm experiencing this strange behavior: when the OnDatabaseChange is
fired at least once, my plugin doesn't unloads and OE6 remains in
memory.
I'm absolutely sure I destroy all COM object in the OnShutdownOEAPI,
setting them to Nothing an then calling GC.Collect /
GC.WaitForPendingFinalizers twice;
if the OnDatabaseChange events does not fire, my plugin unloads
correctly.

My environment is the same as reported in the first message.

Thank you.


On 16 Lug, 23:17, Nektra OEAPI Support <oeapi-supp...@nektra.com>

Nektra OEAPI Support

unread,
Jul 30, 2008, 8:22:47 PM7/30/08
to Nektra...@googlegroups.com
Hi again Rocco,

We were not able to reproduce this behavior. You can try the VB NET DLL
demo included in OEAPI: After triggering the OnDatabaseChange event the
plugin and Outlook Express unload fine.
We would need a sample project/solution ready to reproduce this issue to
check this out. Any further information could help.

Regards,

Federico

Rocco wrote:
> I'm experiencing this strange behavior: when the OnDatabaseChange is
> fired at least once, my plugin doesn't unloads and OE6 remains in
> memory.
> I'm absolutely sure I destroy all COM object in the OnShutdownOEAPI,
> setting them to Nothing an then calling GC.Collect /
> GC.WaitForPendingFinalizers twice;
> if the OnDatabaseChange events does not fire, my plugin unloads
> correctly.
>
> My environment is the same as reported in the first message.
>
> Thank you.

--

Rocco

unread,
Aug 5, 2008, 10:06:23 AM8/5/08
to Nektra OEAPI Support
Ok, but I need a solution for the first issue, please. I must release
a new version now.
Thank you.


On 31 Lug, 02:22, Nektra OEAPI Support <oeapi-supp...@nektra.com>
wrote:

Rocco

unread,
Aug 28, 2008, 10:55:15 AM8/28/08
to Nektra OEAPI Support
I need an answer, please. It'is urgent!
Thank you.

Nektra OEAPI Support

unread,
Aug 29, 2008, 5:35:49 PM8/29/08
to Nektra...@googlegroups.com
Hi again Rocco,

We are sorry about the delay, but we are extremely busy lately.
We have done research on this issue and it seems it is related to the object handling on the .NET framework.
A way to workaround this problem until further research is done, is to call the Garbage Collector on the OnDatabaseChange event, for example:

       void myOEAPI_OnDatabaseChange(tagOE_DATABASE_TRANSACTION dt, int folderId, int objId, int newParentId)
       {
           if (dt.ToString() == "OE_TR_INSERT_MESSAGE")
           {
               Debug.WriteLine("INSERT MESSAGE: " + "Folder Name: " + fm.GetFolder(folderId).Name() + " fid:" + folderId.ToString() + " oid:" + objId.ToString() + " npid:" + newParentId.ToString());
               // etc. etc. etc.
           }

           GC.Collect();
           GC.WaitForPendingFinalizers();
           GC.Collect();
           GC.WaitForPendingFinalizers();

Rocco

unread,
Aug 30, 2008, 3:11:59 AM8/30/08
to Nektra OEAPI Support
Does this workaround address my first issue ("after the first 7-8 new
email arrives, the OnDatabaseChange
events seems not to fire anymore") or the second one ("when
OnDatabaseChange is fired at least once, my plugin doesn't unloads and
OE6 remains in
memory.") ?

Nowadays the .NET platform is THE platform for developing modern
Windows applications, so please test every version extensively on it
before release.
You can't afford not to properly support it. Just my two cents.

Thank you.


On 29 Ago, 23:35, Nektra OEAPI Support <oeapi-supp...@nektra.com>
wrote:
> Hi again Rocco,

Rocco

unread,
Sep 1, 2008, 11:14:26 AM9/1/08
to Nektra OEAPI Support
Unfortunately this does not worked for me: after processing about 10
new messages my plugin stops working and OE6 remains in memory.
Please understand me, I'm delaying the new release because of this
issue....

Thank you.



On 29 Ago, 23:35, Nektra OEAPI Support <oeapi-supp...@nektra.com>
wrote:
> Hi again Rocco,

Nektra OEAPI Support

unread,
Sep 2, 2008, 6:11:50 PM9/2/08
to Nektra...@googlegroups.com
Hi again,

The workaround is for the first issue.

We agree on your comment about the .NET platform and we'll take your suggestion in account.

Regards,

Federico

Nektra OEAPI Support

unread,
Sep 2, 2008, 6:14:07 PM9/2/08
to Nektra...@googlegroups.com
We were not able to reproduce the issue about the process remaining in memory.
We would need you to send us a sample project ready to compile and reproduce it so we can check it out.

We will also keep trying to reproduce this process issue on our own.

Regards,

Federico
Reply all
Reply to author
Forward
0 new messages