FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Bug Reports » Error trying delete user
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Error trying delete user [message #38287] Mon, 30 July 2007 21:39 Go to next message
Shaltay is currently offline  Shaltay   Russian Federation
Messages: 6
Registered: July 2007
Karma: 0
Junior Member
I run v. 2.7.7 RC2 with russian-utf8 translation. So error below appears while trying delete any user:

(/var/FUDforum2/Data/include/theme/default/db.inc:72
/var/FUDforum2/Data/include/users_adm.inc:25
/var/FUDforum2/adm/admuser.php:156
) 1100: Table 'fud_mod' was not locked with LOCK TABLES
Query: DELETE FROM fud_mod WHERE user_id IN(4)
_POST: array ( 'S' => '2544c9c266d86a5f30c128ddefc1bcc8', 'SQ' => 'a4b2e70679d86d77ffa1983edc3b20dc', 'act' => 'del', 'f' => '1', 'usr_id' => '4', 'del_confirm' => '1', 'btn_yes' => 'Yes', )
Server Version: 5.0.32-Debian_7etch1-log
[Referring Page] http://forum.mysite.com/adm/admuser.php?usr_id=4&S=2544c9c266d86a5f30c128ddefc1bcc8&act=del&f=1&SQ=a4b2e70679d86d77ffa1983edc3b20dc


Common server parameters:

System Configuration
PHP built On: Linux server 2.6.18-4-686 #1 SMP Mon Mar 26 17:17:36 UTC 2007 i686
Database Version: 5.0.32-Debian_7etch1-log
PHP Version: 5.2.0-8+etch3
Web Server: Apache/2.2.3 (Debian) PHP/5.2.0-8+etch3
WebServer to PHP interface: apache2handler
WebServer User/Group: 33 / 33
Forum Version: 2.7.7RC2
Relavent PHP Settings:
Safe Mode: OFF
Open basedir: none
Display Errors: OFF
File Uploads: ON
Maximum File Upload Size: 2M
Magic Quotes: OFF
Register Globals: OFF
Output Buffering: Yes
Disabled Functions: none
PSpell Support: No
Zlib Support: Yes

[Updated on: Mon, 30 July 2007 21:42]

Report message to a moderator

Re: Error trying delete user [message #38379 is a reply to message #38287] Tue, 31 July 2007 22:55 Go to previous messageGo to next message
Ilia is currently offline  Ilia   
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
This is fixed in CVS.

Here is the link to the patch:

http://cvs.prohost.org/c/index.cgi/FUDforum/filediff?f=install/forum_data/i nclude/users_adm.inc&v1=1.22&v2=1.23


FUDforum Core Developer
Re: Error trying delete user [message #38390 is a reply to message #38379] Wed, 01 August 2007 16:36 Go to previous messageGo to next message
Shaltay is currently offline  Shaltay   Russian Federation
Messages: 6
Registered: July 2007
Karma: 0
Junior Member
Hello.
I have last version from CVS. The error still persisrs.

# cat /var/www/forum/data/include/users_adm.inc
<?php
/**
* copyright            : (C) 2001-2007 Advanced Internet Designs Inc.
* email                : forum(at)prohost(dot)org
* $Id: users_adm.inc,v 1.23 2007/04/25 18:34:01 hackie Exp $
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; version 2 of the License.
**/

function usr_delete($id)
{
        $tbl = $GLOBALS['DBHOST_TBL_PREFIX'];

        if (!db_locked()) {
                $ll = 1;
                db_lock($tbl.'mod WRITE', $tbl.'msg_store WRITE', $tbl.'forum WRITE, '.$tbl.'msg WRITE, '.$tbl.'group_members WRITE, '.$tbl.'poll_opt_track WRITE, '.$tbl.'users WRITE, '.$tbl.'pmsg WRITE, '.$tbl.'attach WRITE, '.$tbl.'mod WRITE, '.$tbl.'custom_tags WRITE, '.$tbl.'thread_notify WRITE, '.$tbl.'forum_notify WRITE, '.$tbl.'read WRITE, '.$tbl.'forum_read WRITE, '.$tbl.'thread_rate_track WRITE, '.$tbl.'user_ignore WRITE, '.$tbl.'buddy WRITE, '.$tbl.'mod mm WRITE, '.$tbl.'users u WRITE, '.$tbl.'forum f WRITE');
        }

        if (!is_array($id)) {
                $id = array($id);
        }

        q('DELETE FROM '.$tbl.'mod WHERE user_id IN('.implode(',', $id).')');
        if (db_affected()) {
                rebuildmodlist();
        }

        q('DELETE FROM '.$tbl.'custom_tags WHERE user_id IN('.implode(',', $id).')');
        q('DELETE FROM '.$tbl.'thread_notify WHERE user_id IN('.implode(',', $id).')');
        q('DELETE FROM '.$tbl.'forum_notify WHERE user_id IN('.implode(',', $id).')');
        q('DELETE FROM '.$tbl.'read WHERE user_id IN('.implode(',', $id).')');
        q('DELETE FROM '.$tbl.'forum_read WHERE user_id IN('.implode(',', $id).')');
        q('DELETE FROM '.$tbl.'thread_rate_track WHERE user_id IN('.implode(',', $id).')');
        q('DELETE FROM '.$tbl.'user_ignore WHERE user_id IN('.implode(',', $id).')');
        q('DELETE FROM '.$tbl.'user_ignore WHERE ignore_id IN('.implode(',', $id).')');
        q('DELETE FROM '.$tbl.'buddy WHERE user_id IN('.implode(',', $id).')');
        q('DELETE FROM '.$tbl.'buddy WHERE bud_id IN('.implode(',', $id).')');
        q('DELETE FROM '.$tbl.'poll_opt_track WHERE user_id IN('.implode(',', $id).')');
        q('DELETE FROM '.$tbl.'group_members WHERE user_id IN('.implode(',', $id).')');
        q('UPDATE '.$tbl.'msg SET poster_id=0 WHERE poster_id IN('.implode(',', $id).')');

        /* Delete the private messages of this user */
        $c = q('SELECT id FROM '.$tbl.'pmsg WHERE duser_id IN('.implode(',', $id).')');
        while ($r = db_rowarr($c)) {
                pmsg_del($r[0], 5);
        }
        q('UPDATE '.$tbl.'pmsg SET ouser_id=0, read_stamp=post_stamp WHERE ouser_id IN('.implode(',', $id).')');
        q('DELETE FROM '.$tbl.'users WHERE id IN('.implode(',', $id).')');

        if (isset($ll)) {
                db_unlock();
        }
}

function usr_adm_avatar($id, $del=0)
{
        if (!($ud = db_sab('SELECT u.login, u.email, t.name FROM '.$GLOBALS['DBHOST_TBL_PREFIX'].'users u INNER JOIN '.$GLOBALS['DBHOST_TBL_PREFIX'].'themes t ON t.id=u.theme WHERE u.id='.$id))) {
                return;
        }
        $ud->name = preg_replace('![^A-Za-z0-9]!', '_', $ud->name);

        include_once($GLOBALS['INCLUDE'] . 'theme/' . $ud->name . '/avatar_msg.inc');

        if (!$del) {
                q('UPDATE '.$GLOBALS['DBHOST_TBL_PREFIX'].'users SET users_opt=(users_opt|4194304|16777216) & ~ (4194304|16777216) | 8388608 WHERE id='.$id);
                if (db_affected()) {
                        send_status_update($id, $ud->login, $ud->email, $GLOBALS['approved_avatar_title'], $GLOBALS['approved_avatar_msg']);
                }
        } else {
                q('UPDATE '.$GLOBALS['DBHOST_TBL_PREFIX'].'users SET users_opt=(users_opt|8388608|16777216) & ~ (8388608|16777216) | 4194304, avatar_loc=NULL WHERE id='.$id);
                if (db_affected()) {
                        send_status_update($id, $ud->login, $ud->email, $GLOBALS['unapproved_avatar_title'], $GLOBALS['unapproved_avatar_msg']);
                }
        }
}
Re: Error trying delete user [message #38393 is a reply to message #38390] Wed, 01 August 2007 22:49 Go to previous messageGo to next message
Ilia is currently offline  Ilia   
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
The new code contains the supposedly missing lock on the fud_mod table

$tbl.'mod WRITE' <-- block does this.

I've just tried to reproduce the bug on our test forum and there was no issue deleting a user.


FUDforum Core Developer
Re: Error trying delete user [message #38436 is a reply to message #38393] Mon, 06 August 2007 18:19 Go to previous messageGo to next message
Shaltay is currently offline  Shaltay   Russian Federation
Messages: 6
Registered: July 2007
Karma: 0
Junior Member
I Made clear install of last CVS. Confused
Creating user and deleting it at the moment.
Error (in another table) Crying or Very Sad

(/var/FUDforum2/Data/include/theme/default/db.inc:72
/var/FUDforum2/Data/include/users_adm.inc:30
/var/FUDforum2/adm/admuser.php:156
) 1100: Table 'fud_custom_tags' was not locked with LOCK TABLES
Query: DELETE FROM fud_custom_tags WHERE user_id IN(4)
_POST: array ( 'S' => '88c10b18b200ee9132cbd84fbed1fcf1', 'SQ' => '4aa1aaacac950c258e9f7d8c0d224cc7', 'act' => 'del', 'f' => '1', 'usr_id' => '4', 'del_confirm' => '1', 'btn_yes' => 'Yes', )
Server Version: 5.0.32-Debian_7etch1-log
[Referring Page] http://forum.mysite.com/adm/admuser.php?usr_id=4...

Re: Error trying delete user [message #38456 is a reply to message #38436] Wed, 08 August 2007 02:29 Go to previous messageGo to next message
Ilia is currently offline  Ilia   
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
The table is definitely being locked, it is one of the last tables for which the lock is being set.

FUDforum Core Developer
Re: Error trying delete user [message #38469 is a reply to message #38287] Wed, 08 August 2007 11:39 Go to previous messageGo to next message
JanRei is currently offline  JanRei   
Messages: 361
Registered: October 2005
Location: Germany
Karma: 0
Senior Member
Contributing Core Developer
Translator
I think the query is actually not executed completely. Maybe it should like the following?

db_lock($tbl.'mod WRITE, '.$tbl.'msg_store WRITE, '.$tbl.'forum WRITE, '.$tbl.'msg WRITE, '.$tbl.'group_members WRITE, '.$tbl.'poll_opt_track WRITE, '.$tbl.'users WRITE, '.$tbl.'pmsg WRITE, '.$tbl.'attach WRITE, '.$tbl.'custom_tags WRITE, '.$tbl.'thread_notify WRITE, '.$tbl.'forum_notify WRITE, '.$tbl.'read WRITE, '.$tbl.'forum_read WRITE, '.$tbl.'thread_rate_track WRITE, '.$tbl.'user_ignore WRITE, '.$tbl.'buddy WRITE, '.$tbl.'mod mm WRITE, '.$tbl.'users u WRITE, '.$tbl.'forum f WRITE');
Re: Error trying delete user [message #38485 is a reply to message #38469] Fri, 10 August 2007 00:00 Go to previous messageGo to next message
Ilia is currently offline  Ilia   
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
The code in the cvs has:

$tbl.'attach WRITE, '.$tbl.'mod WRITE, '.

so the lock on the mod table is being put in place.


FUDforum Core Developer
Re: Error trying delete user [message #38492 is a reply to message #38287] Fri, 10 August 2007 09:41 Go to previous messageGo to next message
JanRei is currently offline  JanRei   
Messages: 361
Registered: October 2005
Location: Germany
Karma: 0
Senior Member
Contributing Core Developer
Translator
Yes, the mod table is being locked, but I think it is the only one. The first two commas are not within the string and therefore you pass actually three arguments to db_lock.
Re: Error trying delete user [message #38504 is a reply to message #38287] Sun, 12 August 2007 15:09 Go to previous messageGo to next message
Serega is currently offline  Serega   Russian Federation
Messages: 26
Registered: June 2006
Karma: 0
Junior Member
I have this problem too.
Use 2.7.7RC2 version.
Your fixes can not help me.

for example:
	(/mnt/nfs/blade0/www/forum/data/index.php:75
/mnt/nfs/blade0/www/forum/FUDforum/include/users_adm.inc:33
/mnt/nfs/blade0/www/forum/data/theme/DefaultMediaring/login.php:476
/mnt/nfs/blade0/www/forum/data/index.php:1194
) 1100: Table 'fud26_custom_tags' was not locked with LOCK TABLES
Query: DELETE FROM fud26_custom_tags WHERE user_id IN(10540)
_GET: array ( 't' => 'login', 'rid' => '0', )
Server Version: 4.1.20
[Referring Page] http://forum.mediaring.ru/


Sad

also my be 'mod' table...
Re: Error trying delete user [message #38511 is a reply to message #38287] Sun, 12 August 2007 16:07 Go to previous messageGo to next message
Serega is currently offline  Serega   Russian Federation
Messages: 26
Registered: June 2006
Karma: 0
Junior Member
No Message Body

[Updated on: Sun, 12 August 2007 16:10]

Report message to a moderator

Re: Error trying delete user [message #38519 is a reply to message #38492] Sun, 12 August 2007 17:14 Go to previous messageGo to next message
Ilia is currently offline  Ilia   
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
In the code found in the CVS all commas are within quotes, there is only 1 parameter to the db_lock() function.

FUDforum Core Developer
Re: Error trying delete user [message #38525 is a reply to message #38287] Sun, 12 August 2007 18:20 Go to previous messageGo to next message
JanRei is currently offline  JanRei   
Messages: 361
Registered: October 2005
Location: Germany
Karma: 0
Senior Member
Contributing Core Developer
Translator
Well, if I use latest CVS I get the query error Serga and Shaltay posted above saying the table fud26_custom_tags hasn't been locked.

I think that this has something to do with the commas or do you have another explanation why the first two commas are highlighted in green although they should be red like the other ones?
<?php
db_lock
($tbl.'mod WRITE', $tbl.'msg_store WRITE', $tbl.'forum WRITE, '.$tbl.'msg WRITE, '.$tbl.'group_members WRITE, '
?>

[Updated on: Sun, 12 August 2007 19:57]

Report message to a moderator

Re: Error trying delete user [message #38535 is a reply to message #38525] Mon, 13 August 2007 23:20 Go to previous messageGo to next message
Ilia is currently offline  Ilia   
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
My bad it looks like the latest fix was never committed Sad

Here is the latest version:
http://cvs.prohost.org/c/index.cgi/FUDforum/getfile/install/forum_data/incl ude/users_adm.inc?v=1.24


FUDforum Core Developer
Re: Error trying delete user [message #38567 is a reply to message #38287] Wed, 15 August 2007 14:20 Go to previous message
JanRei is currently offline  JanRei   
Messages: 361
Registered: October 2005
Location: Germany
Karma: 0
Senior Member
Contributing Core Developer
Translator
No problem, user deleting seems to be working fine now. Smile
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: ALTernative text in buttons
Next Topic: top message
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 21:03:10 GMT 2024

Total time taken to generate the page: 0.03365 seconds