Closed Bug 256592 Opened 21 years ago Closed 21 years ago

DBD errors (especially "packet too large") kill browser

Categories

(Bugzilla :: Bugzilla-General, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 2.18

People

(Reporter: glob, Assigned: glob)

Details

(Keywords: regression)

Attachments

(1 file, 2 obsolete files)

if you try to add an attachment that is greater than mysql's 'max_allowed_packet' variable, the resulting error message contains the attachment as text, as it contains the sql that failed. this kills firefox on my pc. we should truncate DBI error messages to avoid this.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attached patch dbd errors v1 (obsolete) — Splinter Review
sets maximum length of dbd errors to 4096 chars. no real reason for that particular value :)
Attachment #156806 - Flags: review?
Will this still put the full error message somewhere? It is important that it be accessible. If we truncate the message to the browser, let's make sure it goes in the webserver error log.
If we set the limit to 10000 bytes, is it really important to have it in webserver log? I mean, are there any practical conditions where SQL after 10000 chars would be relevant even for the admin (the only case for that is probably the attachment thing anyway - flooding the attachments into the webserver log doesn't sound necessary to me anyway).
jouni, that was exactly my thinking, i just picked a lower value :)
Comment on attachment 156806 [details] [diff] [review] dbd errors v1 Works. Good to have -- I agree with Byron and Jouni.
Attachment #156806 - Flags: review? → review+
Applies cleanly on branch, too.
Flags: approval?
Flags: approval2.18?
For the record, this is a regression. This bug was previously reported as bug 57819, and was fixed by Gerv with a patch checked in on 2001-10-13. The code was subsequently lost when the DB stuff got ported to its own module by bbaetz on 2003-01-14. Clearing the approval flags because I plan to deny review on this patch for the same reason I made Gerv back out his initial fix to bug 57819.
Flags: approval?
Flags: approval2.18?
Keywords: regression
Target Milestone: --- → Bugzilla 2.18
Comment on attachment 156806 [details] [diff] [review] dbd errors v1 We need to keep the end of the error message, because that's where the actual error is given. Ideally we need to truncate from the middle and keep both ends of the error. The original fix for this that got lost kept 2K off each end and added an elipsis (...) in the middle.
Attachment #156806 - Flags: review-
Attached patch dbd errors v2 (obsolete) — Splinter Review
truncate middle of dbd errors.
Attachment #156806 - Attachment is obsolete: true
Attachment #167916 - Flags: review?
Comment on attachment 167916 [details] [diff] [review] dbd errors v2 + $errstr = substr($errstr, 0, 2000) . ' ... ' . substr($errstr, -2000) + if length($errstr) > 4000; Well I guess we could use substr($_[0], 0, 2000) and such for performance reasons, but this works as well I guess.
Attachment #167916 - Flags: review? → review+
it's a fatal database error, i don't think performance is critical :)
(In reply to comment #7) > for the same reason I made Gerv back out his initial fix to bug 57819. Dave, I don't know about you, but I don't see anywhere in bug 57819 anything to indicate that Gerv backed out its original patch. As far as I can see, an improvement uploaded as the second patch was applied over it. The original patch was never backed out.
(In reply to comment #11) > it's a fatal database error, i don't think performance is critical :) $_[0] could contain the whole attachment, which could be a .jpg or something else, 1 MB wide or something like that. That could take a while to copy from one place to another... :)
Attached patch dbd errors v3Splinter Review
Attachment #167916 - Attachment is obsolete: true
Comment on attachment 167920 [details] [diff] [review] dbd errors v3 This one rocks, no $errstr at all! :)
Attachment #167920 - Flags: review+
Flags: approval?
Flags: approval2.18?
(In reply to comment #12) > Dave, I don't know about you, but I don't see anywhere in bug 57819 anything to > indicate that Gerv backed out its original patch. As far as I can see, an > improvement uploaded as the second patch was applied over it. The original patch > was never backed out. Technicalities! It was the thought that counts, or something like that ;)
Flags: approval?
Flags: approval2.18?
Flags: approval2.18+
Flags: approval+
Checking in Bugzilla/DB.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/DB.pm,v <-- DB.pm new revision: 1.12.2.2; previous revision: 1.12.2.1 done Checking in Bugzilla/DB.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/DB.pm,v <-- DB.pm new revision: 1.14; previous revision: 1.13 done
Status: ASSIGNED → RESOLVED
Closed: 21 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

Creator:
Created:
Updated:
Size: