Closed Bug 273665 Opened 20 years ago Closed 20 years ago

"My Votes" crashes with "Table 'groups' was not locked with LOCK TABLES"

Categories

(Bugzilla :: Creating/Changing Bugs, defect)

2.19.1
defect
Not set
critical

Tracking

()

RESOLVED FIXED
Bugzilla 2.20

People

(Reporter: justdave, Assigned: bugzilla)

References

Details

(Keywords: regression)

Attachments

(1 file)

The following was posted on the developers list:

-------8<--------
Message-ID: <d52201c4dca8$28d83150$6e00000a@opus>
From: "Dave Williss" <dwilliss@microimages.com>
To: "Bugzilla Mailing List" <developers@bugzilla.org>
Subject: Fw: [all-list] Bugzilla - Some suggestions...
Date: Tue, 7 Dec 2004 15:59:33 -0600

This is with bugzilla 2.19.1...

When I try to look at "My Votes" now I get:

Software error:
DBD::mysql::db selectcol_arrayref failed: Table 'groups' was not locked with 
LOCK TABLES [for Statement "SELECT DISTINCT groups.name, group_id
                                              FROM groups, user_group_map
                                             WHERE 
groups.id=user_group_map.group_id
                                               AND user_id=?
                                               AND isbless=0"] at 
Bugzilla/User.pm line 227
 Bugzilla::User::groups('Bugzilla::User=HASH(0x84be9a0)') called at 
Bugzilla/User.pm line 277
 Bugzilla::User::can_see_bug('Bugzilla::User=HASH(0x84be9a0)', 5383) called 
at /raid/bugzilla/votes.cgi line 188
 main::show_user() called at /raid/bugzilla/votes.cgi line 76

For help, please send mail to the webmaster (root@localhost), giving this 
error message and the time and date of the error. 

-------8<--------

I can reproduce this on the tip, I cannot reproduce it on the 2.18 branch.
Flags: blocking2.20+
Target Milestone: --- → Bugzilla 2.20
was investigationg this one, and upon voting, then unvoting, then disabling 
voting for that product I got:

http://projects.pdinc.us/editproducts.cgi

Update product  
    
Updated votes per user.
Updated votes to confirm.
Checking existing votes in this product for anybody who now has too many 
votes.Content-type: text/html 
Software error:
DBD::mysql::st execute failed: You have an error in your SQL syntax.  Check the 
manual that corresponds to your MySQL server version for the right syntax to 
use near 'now(),8,'UNCONFIRMED','NEW')' at line 1 [for Statement "INSERT INTO 
bugs_activity (bug_id,who,bug_when,fieldid,removed,added) VALUES (279,,now
(),8,'UNCONFIRMED','NEW')"] at Bugzilla/DB.pm line 62
	Bugzilla::DB::SendSQL('INSERT INTO bugs_activity 
(bug_id,who,bug_when,fieldid,removed,a...') called at CGI.pl line 255
	main::CheckIfVotedConfirmed(279, undef) called 
at /home/vhome/com.pyerotechnics/httpd/html/projects/editproducts.cgi line 1444

For help, please send mail to the webmaster (webmaster@pdinc.us), giving this 
error message and the time and date of the error. 
*** Bug 258464 has been marked as a duplicate of this bug. ***
(In reply to comment #1)
> was investigationg this one, and upon voting, then unvoting, then disabling 
> voting for that product I got:

Jason: That SQL software error looks like bug#271474
The fix to this looks like adding ' groups READ ' into the LOCK TABLES sql at
line 133 of votes.cgi - yes? (But I'm not in front of my test installs at the
mo., so I can't test that)

As an aside: It doesn't seem ideal that top level routines like those in
votes.cgi need to know all the tables that need to be locked by any subroutines
or library routines which may be called - is there a better way of doing that
somehow?
Assignee: myk → bugzilla
Status: NEW → ASSIGNED
Attachment #168336 - Flags: review?(vladd)
There's been other bugs dealing with this issue in other CGIs, you should track
down those bugs and see what they did, or get opinions from the folks that
worked on them.  Seems like there was talk of a centralized way to do that at
some point, but I don't know if it every happened.
Comment on attachment 168336 [details] [diff] [review]
lock the groups table as well

This solves the issue.

The right thing would be probably to lock at the Bugzilla::User.pm level with a
safe-back mechanism to be sure we're not locking twice the same thing. However
that might be too dangerous anyway for 2.20rc1.
Attachment #168336 - Flags: review?(vladd) → review+
Flags: approval?
Re: Comment 7

I agree that that would be dangerous.  If you try to "relock", you may well get
a deadlock because you already have one table locked and someone else is looking
for it while they are holding a lock on your additional table and you are
waiting for them.

forward thinking, perhaps we can put a GetLocks() method in each library which
returns an array of the tables that need to be locked by that library...  then
places that use that library can call it and add their own tables to the list if
they aren't already present.
Flags: approval? → approval+
Checking in votes.cgi;
/cvsroot/mozilla/webtools/bugzilla/votes.cgi,v  <--  votes.cgi
new revision: 1.20; previous revision: 1.19
done
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
This bug has returned.  Please reopen.
DBD::mysql::db selectcol_arrayref failed: Table 'groups' was not locked with
LOCK TABLES [for Statement "SELECT DISTINCT groups.name, group_id
                                              FROM groups, user_group_map
                                             WHERE groups.id=user_group_map.group_id
                                               AND user_id=?
                                               AND isbless=0"] at
Bugzilla/User.pm line 227
	Bugzilla::User::groups('Bugzilla::User=HASH(0x996ebac)') called at
Bugzilla/User.pm line 277
	Bugzilla::User::can_see_bug('Bugzilla::User=HASH(0x996ebac)', 9468) called at
/opt/webtools/bugzilla/votes.cgi line 188
	main::show_user() called at /opt/webtools/bugzilla/votes.cgi line 76

For help, please send mail to the webmaster (root@localhost), giving this error
message and the time and date of the error. 
Whiteboard: [applied to b.m.o]
Blocks: 304356
(In reply to comment #11)
> This bug has returned.  Please reopen.

What version of Bugzilla are you using?
Whiteboard: [applied to b.m.o]
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: