Jump to:
| Project: | DrupalEd |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | bonobo |
| Status: | postponed (maintainer needs more info) |
Issue Summary
Drupaled 5.1.2. Freshly downloaded and installed.
Dropped the original install tables and loaded the oa_drupaled_070716.sql mysql dump. Logged in as admin, reset the admin password from the default and configured the site. The first user to try and register for a new account received the following error:
-----------------------
Access denied
* user warning: Duplicate entry '1' for key 1 query: INSERT INTO drupal_users (name, mail, pass, init, status, uid, created) VALUES ('name sanitized', 'email sanitized', 'sanitized', 'email sanitized', 1, 1, 1184785232) in /var/www/localhost/orecity/includes/database.mysql.inc on line 172.
* user warning: Duplicate entry '1' for key 2 query: INSERT INTO drupal_tokenauth_tokens (uid, token) VALUES (1, 'sanitized') in /var/www/localhost/orecity/includes/database.mysql.inc on line 172.
Welcome to Drupal. You are user #1, which gives you full and immediate access. All future registrants will receive their passwords via e-mail, so please make sure your website e-mail address is set properly under the general settings on the site information settings page.
Your password is sanitized. You may change your password below.
You are not authorized to access this page.
-----------------------
It appears that the uid counter is not initially incremented. Follow-up registrations seem to work fine.
Comments
#1
I have not been able to replicate this on two test installs, one on a linux box, the other on a wamp stack --
Is tokenauth enabled on your site?
What was the uid of the newly created user?
If you logged in as admin and enabled the user/reset the password, could the user then navigate the site, or did the error persist?
I'll also check the sequences table and see if anything looks off there...
#2
I'm having a hard time seeing anything, since it seems like the system tried to re-register the uid1 user a second time. There's nothing in the list of users that seems out of the ordinary now. As best I can tell, the first failed registration "woke up" the uid increment and the following registrations worked fine.
System details:
Gentoo, 2.6.18-hardened x86_64 kernel
Apache 2.0.58
MySQL 5.0 on a remote server
#3
I think there's something a bit hinky in the auto-incrementing. The initial error I reported only happens on the first user created. If I attempt to create a dummy user immediately after installation, it gives me a duplicate key error. All new user creations after that work perfectly.
I just ran into a very similar error when trying to add another menu that I suspect is related:
user warning: Duplicate entry '5' for key 1 query: INSERT INTO menu (mid, pid, path, title, description, weight, type) VALUES (5, 0, '', 'test', '', 0, 115) in /var/www/localhost/{sitename}/includes/database.mysql.inc on line 172.
It looks to me like when using the oa_*.sql file does not include the auto-increment status.
#4
I have tried to duplicate this on clean an older installs, and haven't seen this --
Feel free to contact me off-list with a url -- I'd be glad to take a closer look at this.
#5
Marking this as postponed as a precursor to closing the issue -- if anyone can replicate this with the 5.3 release please re-open the issue.
#6
I am seeing the same issues. Running WAMP (on Server 2003 enterprise). I have done a clean install but in a subdirectory - cleaned it all out and done it again. I had to edit the .sql installation file because I wanted to use the same database as another drupal install so had to add a table-prefix. Did this with a text editor and checked thoroughly.
I get the "duplicate key" error. This seems to occur with any new item, new user or change to the system. Depending on the context, I will get a blank page or the error will display.
#7
Can you give more info on your setup?
What version of DrupalEd are you using?
If you have the 5.3 release, make sure that you have the token module installed and enabled.
I attempted to replicate this in a couple of our test environments, and had no luck -- everything worked as it should.
#8
I ran into an almost similar problem when importing users to a test site.
The problem showed on both 5.3 and 5.7. Since I only had a few users for the 5.3 test site, the problem cleared itself after trying to enter a new user several times. When the same problem appears again in the 5.7 site, I tracked it down.
Importing only the users caused a mismatch between the number of UIDs and the number stored in the SEQUENCES table for the "user_id".
Resetting the number of the "user_id" in the SEQUENCES table to match the highest UID (or set it higher), cleared the problem.
#9
The problem seems to appear mostly with the profiles that add users with database queries and the increment does not run.
Edit the profile you are using to unsert the missing increment in the database:
db_query("INSERT INTO {sequences} (`name`, `id`) VALUES ('users_uid', 2)");Replace "2" in the end with the number of users you are adding with the query.
Or, the fix for the existing problem is to create a page with php filter enabled and run
<?php db_query("UPDATE {sequences} SET id = 2 WHERE name = 'users_uid' "); ?>#10
Thanks for posting this -- I'll test this, with an eye toward including it in the next rollout --
#11
Hi
I reproduced this after running the wiki installation profile and then registering a new user.
Based on 5.x dev code (end of March 2008), mysqli, on ubuntu 7.04 feisty and with mysql 5.0.38 and php 5.2.1
user warning: Duplicate entry '1' for key 1 query: INSERT INTO users (name, mail, pass, init, status, uid, created) VALUES ('Olivier Vit', 'ffffffff@free.fr', '594bd8d18d7da8b830563418650a43a1', 'ffffffff@free.fr', 1, 1, 1207577740) in xxxxxxxxxxxxx/drupal/includes/database.mysqli.inc on line 151.