MailMerge: SendMail - possible race condition

Alex McMurchy mcmurchy1917-libreoffice at yahoo.co.uk
Mon Nov 7 10:05:14 UTC 2016


There's been a lot of changes in respect of MailMerge with LibreOffice 
5.2 onwards and I've been caught out by some of these changes and raised 
bug reports for -

bug 102951 <https://bugs.documentfoundation.org/show_bug.cgi?id=102951> 
for the MailMerge wizard which has been resolved as just a change of the 
MailMerge GUI being split;

bug 102010 <https://bugs.documentfoundation.org/show_bug.cgi?id=102010> 
which is still waiting for a fix

Anyway, I've moved on and done some testing of the SendMail part of 
MailMerge and encountered what appears to be a race condition. In that 
if I generate a MailMerge for 2 recipients -

 1. the email for the second recipient appears to be never sent and
    definitely never ever received.
 2. the success of the email for the first recipient is that it always
    looks like it's been sent but mostly it's never received. When it is
    received it is occasionally corrupted.

However if I put in 2 sleeps in the file 
sw/source/ui/dbui/mmoutputtypepage.cxx as per this git diff, below, I 
consistently see the emails being sent and received successfully. This 
would appear to suggest that it's thread related though I have no 
knowledge of threads so I could be way of the mark here.

Unrelated, I've done some changes to the file mailmerge.py to enable me 
to send messages through the "mail.btinternet.com" smtp server so it 
would be good to discuss these changes with someone. Any suggestions as 
to who?

For the suspected race condition should I raise a bug with my findings 
or wait to discuss with someone more knowledgeable?

Alex

> index 5e42b2f..52db84c 100644
> --- a/sw/source/ui/dbui/mmoutputtypepage.cxx
> +++ b/sw/source/ui/dbui/mmoutputtypepage.cxx
> @@ -36,6 +36,13 @@
>  #include <maildispatcher.hxx>
>  #include <imaildsplistener.hxx>
>
> +#ifdef _WIN32
> +#include <windows.h>
> +#else
> +#include <unistd.h>
> +#include <time.h>
> +#endif
> +
>  using namespace ::com::sun::star;
>
>  SwMailMergeOutputTypePage::SwMailMergeOutputTypePage(SwMailMergeWizard* 
> pParent)
> @@ -313,6 +320,8 @@ void SwSendMailDialog::dispose()
>      {
>          try
>          {
> +        sleep(1);
> +
>              if(m_pImpl->xMailDispatcher->isStarted())
>                  m_pImpl->xMailDispatcher->stop();
>              if(m_pImpl->xConnectedMailService.is() && 
> m_pImpl->xConnectedMailService->isConnected())
> @@ -482,6 +491,7 @@ void  SwSendMailDialog::IterateMails()
>          if(m_pConfigItem->IsMailReplyTo())
> pMessage->setReplyToAddress(m_pConfigItem->GetMailReplyTo());
>          pMessage->addRecipient( pCurrentMailDescriptor->sEMail );
> +    sleep(1);
>          pMessage->SetSenderName( m_pConfigItem->GetMailDisplayName() );
>          pMessage->SetSenderAddress( m_pConfigItem->GetMailAddress() );
> if(!pCurrentMailDescriptor->sAttachmentURL.isEmpty())




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20161107/4fb4d38d/attachment.html>


More information about the LibreOffice mailing list