One mail, two bugs reported

This plugin allows you to report an issue in MantisBT by sending an email to a particular mail account

Moderators: Developer, Contributor

Post Reply
jcgallardo
Posts: 8
Joined: Mar 30, 2016 9:14 am

One mail, two bugs reported

Post by jcgallardo » Jan 23, 2019 12:33 pm

Mantis 2.18.0
EmailReporting 0.10.1

I have configured a IMAP Folder in an Office 365 mailbox. We have configured email reporting to not to delete the emails procesed.

I received an email three weeks ago, and when I put it in autoreporting folder, email reporting added this mail as a new incident with id-bug-number 87000. We resolved the incident and close the bug, but we didn't delete the email from the autoreporting folder.

Today we see that Emailreporting had procesed the mail again and create a new incident with id-bug-number 88000.

I have reviewed the 'mantis_plugin_emailreporting_msgids_table' and I surprised to see that the old bug (id-87000) didn't have a msg_id, and the new bug (id-88000) had the msg_id that corresponding to the email.

How is it possible? Is a bug or a user action?


P.D: Email reporting didn´t associate the bugs.

SL-Gundam
Posts: 573
Joined: Jul 06, 2011 9:17 am

Re: One mail, two bugs reported

Post by SL-Gundam » Jan 23, 2019 5:17 pm

IMAP works differently from POP3 when it concerns the deletion of emails: Please read this: http://www.mantisbt.org/wiki/doku.php/m ... ilbox_type

IMAP towards Exchange has always been an issue because of an incomplete IMAP4rev1 implementation on the exchange side. EmailReporting 0.9.x and 0.10.x fixed a lot of issues with Exchange but as you've noticed it is not perfect

If issues are deleted from MantisBT, the references are also deleted from mantis_plugin_emailreporting_msgids_table
Are you triggering EmailReporting manually to import emails or does it happen on a schedule?

jcgallardo
Posts: 8
Joined: Mar 30, 2016 9:14 am

Re: One mail, two bugs reported

Post by jcgallardo » Feb 14, 2019 6:57 am

Thanks for your answer.

I have configured a scheduled task to run every 2 minutes. If the task is running, we doesnt launch a new instance task.

We don't delete bugs, we only close it.

I have a XAMPP instalacion on Windows Server 2012, the Mantis version is 2.18.0 and the emailreporting is version 0.10. Some month ago, we have Mantis version 1.3 and emailreporting version 0.9 and never had this problem.

Do you know what can we do to resolve it?

SL-Gundam
Posts: 573
Joined: Jul 06, 2011 9:17 am

Re: One mail, two bugs reported

Post by SL-Gundam » Feb 14, 2019 1:36 pm

What might have happened is that EmailReporting did not fully run to completion.
If EmailReporting encounters a fatal error before fully finishing the mailbox, emails are not deleted/marked as read.

We've recently found an issue with reference id parsing.
https://github.com/mantisbt-plugins/Ema ... 5bb7939d35

Please update to 0.11.0-DEV and see if that works better

jcgallardo
Posts: 8
Joined: Mar 30, 2016 9:14 am

Re: One mail, two bugs reported

Post by jcgallardo » Mar 15, 2019 10:21 am

I have added some points of log the proccess and I think the problem is on this point of process_imap_mailbox function (see attach) but I can't know how can I have to resolve it.

In this case, I have an email that was registered in Mantis ten days before (id=90323) and during ten days the program didn't register the incident again.

Yesterday I saw that the plugin had reported the same email with another id bug (id=90765) and had added a relationship with the first id bug.

Can you help me?
Attachments
emailreporting_error.png
emailreporting_error.png (56.91 KiB) Viewed 1218 times

SL-Gundam
Posts: 573
Joined: Jul 06, 2011 9:17 am

Re: One mail, two bugs reported

Post by SL-Gundam » Mar 15, 2019 12:03 pm

Because of your code modifications the line numbers don't add up

Please provide your modified mail_api.php

jcgallardo
Posts: 8
Joined: Mar 30, 2016 9:14 am

Re: One mail, two bugs reported

Post by jcgallardo » Mar 20, 2019 10:32 am

Thanks. Here is my modified mail_api.php
Attachments
mail_api.php.txt
(63.01 KiB) Downloaded 105 times

SL-Gundam
Posts: 573
Joined: Jul 06, 2011 9:17 am

Re: One mail, two bugs reported

Post by SL-Gundam » Mar 20, 2019 12:34 pm

You are right concerning the line where it goes wrong.

As i understand it, the folder in the mailbox contains quite a lot of old, already processed, emails. So EmailReporting makes a lot of flag checks to see whether they are marked as deleted/processed.

It might be that Office365 does not like that. I'm gonna look into caching the results

SL-Gundam
Posts: 573
Joined: Jul 06, 2011 9:17 am

Re: One mail, two bugs reported

Post by SL-Gundam » Mar 20, 2019 1:06 pm

Made some changes
https://github.com/mantisbt-plugins/Ema ... 404d2ae56b

Hopefully this works better for you

jcgallardo
Posts: 8
Joined: Mar 30, 2016 9:14 am

Re: One mail, two bugs reported

Post by jcgallardo » Mar 25, 2019 11:07 am

I tried with your changes and the scheduled task didn't run (I have any record in mantis.log).

I have turned the version back and checked the logs. I have seen that in PHP log there is this error that repeated every two minutes during the time I have the new version.

[25-Mar-2019 16:39:27 Europe/Berlin] PHP Fatal error: Cannot use isset() on the result of an expression (you can use "null !== expression" instead) in D:\xampp\htdocs\mantis\plugins\EmailReporting\core\mail_api.php on line 684

The line 684 belons to the isDeleted function and is one of the modified lines.

I have checked all modified lines and I can see where is the error.

Can you help me? I attached the modified files and a Image with php error log.

Thanks in advance

P.D: I tried with ( null !== EXPRESSION ) and, in the first time, the system registered every mails that I have in the imap folder as new bugs and in the rest of the times, it registered as new notes in the same bug.
Attachments
mail_api.php.txt
(63.47 KiB) Downloaded 94 times
IMAP.php.txt
(95.08 KiB) Downloaded 105 times
emailreporting_phperror.png
emailreporting_phperror.png (107.31 KiB) Viewed 1139 times

SL-Gundam
Posts: 573
Joined: Jul 06, 2011 9:17 am

Re: One mail, two bugs reported

Post by SL-Gundam » Mar 25, 2019 12:14 pm

You modified your code incorrectly.
The dollar signs are missing on multiple lines for $p_flags

I suggest you go here https://github.com/mantisbt-plugins/EmailReporting and click the "clone or download" button and click on "download zip"

use that to overwrite all existing files

jcgallardo
Posts: 8
Joined: Mar 30, 2016 9:14 am

Re: One mail, two bugs reported

Post by jcgallardo » Mar 26, 2019 11:14 am

Fu**! Fu**! Fu**! What a shame! I checked it several times and I did not see it. Apologies.

I have changed all the files as you indicated and it is working correctly and the time to check the mailboxes has decreased significantly.

Thank you again for your support and patience.

SL-Gundam
Posts: 573
Joined: Jul 06, 2011 9:17 am

Re: One mail, two bugs reported

Post by SL-Gundam » Mar 26, 2019 1:32 pm

Very good that the problem is resolved. Even better that we also see a nice performance improvement :D

SL-Gundam
Posts: 573
Joined: Jul 06, 2011 9:17 am

Re: One mail, two bugs reported

Post by SL-Gundam » Apr 18, 2019 4:35 am

In case your interested

Another user contacted us through the MantisBT issue tracker with performance problems
https://www.mantisbt.org/bugs/view.php?id=25701

This resulted in a change that again improved performance significantly
https://github.com/mantisbt-plugins/Ema ... 6c8490d09e

Post Reply