Yiannis Zapitis writes:

I installed Persistent Login. However when I close the browser and come
back in (after having selected remember me) I get this error:

user warning: Duplicate entry '1-f044d9d0154cb092fd9adcb221bfce40' for key
'PRIMARY' query: INSERT INTO persistent_login (uid, series, token, expires)
VALUES (1, 'f044d9d0154cb092fd9adcb221bfce40',
'23ae55ae095518572195b965613337bf', 1198902019) in
C:\drupal\includes\database.mysql.inc on line 172.

If i close the browser and come back I get a security alert that the
cookie is incorrect and that as a precaution all data was deleted, I have
to log in again and cycle repeats.

I used the 5.x versions, tried both beta1 and dev, same result.

If you could give me any ideas about what might be the problem i would be
very grateful.

Thank you.

Comments

bjaspan’s picture

Interesting. This "shouldn't" be possible but I almost see how it could occur. It looks like PL's hook_user('login') is being invoked twice, both times with $edit['persistent_login'] == 1. I'm not sure how this is happening. I'm pretty sure I can fix by invalidating all PL entries for the current user before setting a new cookie in it in persistent_login_setcookie(), but first I'd like to understand why it is happening.

So, please tell me all modules that are enabled on your site.

bjaspan’s picture

Yiannis writes:

Hello,

Actually I found the problem and it was not with the module, it was with MySQL. For some weird reason, the query:

DELETE FROM persistent_login WHERE uid = N AND series = 'xxxx'

deletes no records and that is why the INSERT fails. However the query:

SELECT * FROM uid = N AND series = 'xxxx'

does return the correct rows. Also note that the query:

DELETE FROM persistent_login WHERE serires = 'xxxx'

does work.

So this looks like a MySQL bug or something but I changed table types from InnoDB to MyISAM and the problem was instantly fixed. I was using MySQL 6.0 alpha in this case but still I would not have expected such a fundamental flaw (unless InnoDB is supposed to work in this way!).

Anyway, thanks for looking at this and thanks for a great module.

bjaspan’s picture

Status: Active » Fixed

Well, that's weird and inexplicable but I'll chalk it up to a MySQL 6.0 alpha bug unless someone brings it up again.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

yosisays’s picture

I'm using drupal v. 6.16 and persistent login v. 6.x-1.4

I'm seeing this error:

user warning: Duplicate entry '1-f42f6071439a8d43b38b7e02e8eaf822' for key 'PRIMARY' query: INSERT INTO persistent_login (uid, series, token, expires) VALUES (1, 'f42f6071439a8d43b38b7e02e8eaf822', '3fc356d5d32bd28f4ce0fb12bb04a6a6', 1282778655) in /sites/all/modules/persistent_login/persistent_login.module on line 422.

What was the fix for this?