Closed Bug 225042 Opened 21 years ago Closed 19 years ago

If sendmail dies while processing a duplicate it corrupts the duplicates table

Categories

(Bugzilla :: Email Notifications, defect)

2.17.5
defect
Not set
major

Tracking

()

RESOLVED FIXED
Bugzilla 2.18

People

(Reporter: ningcao97, Assigned: LpSolit)

Details

(Keywords: dataloss)

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031007 Firebird/0.7
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031007 Firebird/0.7

Bugzilla sends emails when a bug is marked as duplicated.

When it failes to connect to SMTP server, an error message is printed in red.
Unfortunately, it failed to insert data into duplicates table, thus cause the
follwing line to be displayed when running sainty check:

Bug(s) found marked resolved duplicate and not on duplicates table: 1229, 1247, ...

And, when I go to the bug 1229, the following message appeared and I could not
get the information:

URL: http://192.126.9.205/bugzilla-2.17.4/show_bug.cgi?id=1229
undef error - GetBugLink() called with non-integer bug number at
D:/Perl/lib/CGI/Carp.pm line 301.

I found that data has been added to bugs, bugs_activity and longdescs table, but
the item is missing in duplicates table.

Now, I have to lookup the longdescs table to fix the invalid items.


Reproducible: Always

Steps to Reproduce:
1. Turn the email sending for the bug owners
2. Set the SMTP server to forbid the access of bugzilla
3. Mark a bug(#a) as duplicated to another one(#b)
4. Running sainty check or visit bug #a or #b

Actual Results:  
item is missing in duplicates table.

Expected Results:  
Just like other functions, send mail after all the database operation has finished.

Using Win2000, I have changed the source code a little to send emails:

In CGI.pl

#    open SENDMAIL, "|/usr/lib/sendmail -t -i";
#    print SENDMAIL $msg;
#    close SENDMAIL;
use Net::SMTP;
my $smtp_server = '127.0.0.1';  # change this

my $smtp = Net::SMTP->new($smtp_server) ||
  die 'Cannot connect to server \'$smtp_server\'';

$smtp->mail('caon@thit.com.cn');  # change this
$smtp->to($login);
$smtp->data();
$smtp->datasend($msg);
$smtp->dataend();
$smtp->quit;

The smtp server I use is IIS.
Reproduced on landfill with the current (non-modified) mail architecture.  If
anything goes wrong trying to call Sendmail while marking a dupe, it corrupts
the duplicates table.

This is actually in the mail notification code where it's dying, so passing off
to JayPee.

Believe it or not, this does not affect 2.16.4 because processmail is a separate
process, so when it dies, process_bug just keeps going after printing the error
message.
Assignee: myk → preed
Status: UNCONFIRMED → NEW
Component: Creating/Changing Bugs → Email Notifications
Ever confirmed: true
Keywords: dataloss
OS: Windows 2000 → All
Hardware: PC → All
Target Milestone: --- → Bugzilla 2.18
Version: unspecified → 2.17.5
Summary: Unable to connet to smtp server may cause data error when mark bugs as duplicate → If sendmail dies while processing a duplicate it corrupts the duplicates table
All 2.18 bugs that haven't been touched in over 60 days and aren't flagged as
blockers are getting pushed out to 2.20
Target Milestone: Bugzilla 2.18 → Bugzilla 2.20
As preed is no longer actively working on Bugzilla (from what I know), I somehow
doubt that this bug will make it in for 2.20. :-) If I'm wrong, feel free to
take it back and re-target it. :-)
Assignee: preed → email-notifications
Target Milestone: Bugzilla 2.20 → ---
Flags: blocking2.20?
Flags: blocking2.18.2?
Target Milestone: --- → Bugzilla 2.18
Flags: blocking2.20?
Flags: blocking2.20+
Flags: blocking2.18.2?
Flags: blocking2.18.2+
Do all required changes to the DB before sending emails.
Assignee: email-notifications → LpSolit
Status: NEW → ASSIGNED
Attachment #185618 - Flags: review?(wicked)
Comment on attachment 185618 [details] [diff] [review]
untested patch, v1

Reviewing patch per LpSolit's request.

This looks good. I don't have Sendmail installed so I can't test it.

There isn't any more processing done after the dependency stuff, and the code
is simply moved from one place to another, so there's nothing to go wrong here
(meaning it's pretty low-risk).
Attachment #185618 - Flags: review+
Attachment #185618 - Flags: review?(wicked)
Flags: approval?
Flags: approval2.18?
This patch does not apply cleanly on the 2.18 branch
Flags: approval?
Flags: approval2.18?
backport. Same patch (modulo some nits such as line length)
Attachment #185704 - Flags: review?(justdave)
Attachment #185704 - Flags: review?(vladd)
Flags: approval?
Flags: approval2.18?
Comment on attachment 185704 [details] [diff] [review]
patch for 2.18.1, v1

> backport. Same patch (modulo some nits such as line length)

D'oh.
Attachment #185704 - Flags: review?(vladd)
Attachment #185704 - Flags: review?(justdave)
Attachment #185704 - Flags: review+
Flags: approval?
Flags: approval2.18?
Flags: approval2.18+
Flags: approval+
Tip:

Checking in process_bug.cgi;
/cvsroot/mozilla/webtools/bugzilla/process_bug.cgi,v  <--  process_bug.cgi
new revision: 1.257; previous revision: 1.256
done


2.18.1:

Checking in process_bug.cgi;
/cvsroot/mozilla/webtools/bugzilla/process_bug.cgi,v  <--  process_bug.cgi
new revision: 1.205.2.21; previous revision: 1.205.2.20
done
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
QA Contact: matty_is_a_geek → default-qa
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: