OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



DB Error: Duplicate entry XXX for key 'sessions_pkey'

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

DB Error: Duplicate entry XXX for key 'sessions_pkey'

Postby habeas_corpse » Fri Dec 17, 2010 5:41 am

Hi,

firstly, sorry for my bad english.
i am with a problem on the OJS, where on the access, show the follow error:
DB Error: Duplicate entry 'kql2bfaoeupf14qklu7lr636g6' for key 'sessions_pkey'

oh my god, who will help-me.

my ojs application is:
http://www1.ifro.edu.br/revista
habeas_corpse
 
Posts: 5
Joined: Tue Sep 29, 2009 7:09 am

Re: DB Error: Duplicate entry XXX for key 'sessions_pkey'

Postby jmacgreg » Sun Dec 19, 2010 1:19 pm

Hi habeas_corpse,

Which version of OJS are you using? Have you recently installed, or have you tried to upgrade? Was it working previously?

Cheers,
James
jmacgreg
 
Posts: 4186
Joined: Tue Feb 14, 2006 10:50 am

Re: DB Error: Duplicate entry XXX for key 'sessions_pkey'

Postby habeas_corpse » Wed Dec 22, 2010 8:25 am

hi,

I upgraded from 2.1 to 2.2, but only files, not the database.
habeas_corpse
 
Posts: 5
Joined: Tue Sep 29, 2009 7:09 am

Re: DB Error: Duplicate entry XXX for key 'sessions_pkey'

Postby jmacgreg » Thu Dec 23, 2010 12:30 pm

Hi habeas_corpse,

If your install is in an inconsistent state, you will most likely encounter errors. Try upgrading the database to your file version, and then check again to see if you are encountering the same error.

Cheers,
James
jmacgreg
 
Posts: 4186
Joined: Tue Feb 14, 2006 10:50 am

DB Error: Duplicate entry XXX for key 'sessions_pkey'

Postby solty » Mon Apr 18, 2011 5:43 am

Dear Alec and James,
Today our journal crashed with error. During the last 20 days, I was not change any setting and new issue creation. But I see:

DB Error: Duplicate entry 'oiM53VcqeJwujFpccwPfs7Iqudl86mXY' for key 'sessions_pkey'

Stack Trace:
File: /var/www/vhosts/neuroquantology.com/httpdocs/journal/lib/pkp/classes/session/SessionDAO.inc.php line 74
Function: DAO->update("INSERT INTO sessions (session_id, ip_address, user_agent, cr...", Array(7))

File: /var/www/vhosts/neuroquantology.com/httpdocs/journal/lib/pkp/classes/session/SessionManager.inc.php line 82
Function: SessionDAO->insertSession(Object(Session))

File: /var/www/vhosts/neuroquantology.com/httpdocs/journal/lib/pkp/classes/session/SessionManager.inc.php line 115
Function: SessionManager->SessionManager(Object(SessionDAO), Object(Request))

File: /var/www/vhosts/neuroquantology.com/httpdocs/journal/classes/security/Validation.inc.php line 283
Function: SessionManager->getManager()

File: /var/www/vhosts/neuroquantology.com/httpdocs/journal/lib/pkp/classes/core/PKPPageRouter.inc.php line 65
Function: Validation->isLoggedIn()

File: /var/www/vhosts/neuroquantology.com/httpdocs/journal/lib/pkp/classes/core/Dispatcher.inc.php line 114
Function: PKPPageRouter->isCacheable(Object(Request))

File: /var/www/vhosts/neuroquantology.com/httpdocs/journal/lib/pkp/classes/core/PKPApplication.inc.php line 155
Function: Dispatcher->dispatch(Object(Request))

File: /var/www/vhosts/neuroquantology.com/httpdocs/journal/index.php line 66
Function: PKPApplication->execute()


I was not find any solution...

Sincerely,
solty
 
Posts: 140
Joined: Mon Mar 16, 2009 12:47 am
Location: Turkiye, İzmir

Re: DB Error: Duplicate entry XXX for key 'sessions_pkey'

Postby mcrider » Fri Apr 22, 2011 12:05 pm

Hi Solty,

Is this happening consistently or only once? Try clearing the user sessions by clicking on the 'Expire User Sessions' link from the site admin's user home page. That should at least temporarily solve the problem -- but if it happens again, we can diagnose it further.

Cheers,
Matt
mcrider
 
Posts: 952
Joined: Mon May 05, 2008 10:29 am
Location: Vancouver, BC

Re: DB Error: Duplicate entry XXX for key 'sessions_pkey'

Postby mamen » Fri Jun 24, 2011 1:11 am

Good Day,

I have the same problem of this topic in my ojs site but I can't log on in ojs site admin so I can't 'expire sessions'.
What can I do in order to log in and try this?

The version of mit ojs site is 2.2.4. and php5.3 and mysql 5.1.49.

Thanks in advance.
mamen
 
Posts: 1
Joined: Fri Jun 24, 2011 12:51 am

Re: DB Error: Duplicate entry XXX for key 'sessions_pkey'

Postby jmacgreg » Mon Jun 27, 2011 4:23 pm

Hi mamen,

Unfortunately, you will have to ask your Site Administrator to do this for you.

Cheers,
James
jmacgreg
 
Posts: 4186
Joined: Tue Feb 14, 2006 10:50 am

Re: DB Error: Duplicate entry XXX for key 'sessions_pkey'

Postby solty » Thu Jun 30, 2011 8:12 am

mcrider wrote:Hi Solty,

Is this happening consistently or only once? Try clearing the user sessions by clicking on the 'Expire User Sessions' link from the site admin's user home page. That should at least temporarily solve the problem -- but if it happens again, we can diagnose it further.

Cheers,
Matt


Thank you Matt Problem solved!
solty
 
Posts: 140
Joined: Mon Mar 16, 2009 12:47 am
Location: Turkiye, İzmir

Re: DB Error: Duplicate entry XXX for key 'sessions_pkey'

Postby IDMsly » Mon Jan 23, 2012 7:31 am

I have had this error on a new installation on both OCS and OJS Any link from the home page
local machine with SuSe linux,latest PHP and MySQL, Mozilla browser, cannot recall Apache version
Have tried deleting entries from sessions tables.
Error messages as follows, please advise:-

"""
mysql): SELECT * FROM sessions WHERE session_id = 'hjdsshde79g29soelaqsnficj6fkb4gdpgdh9271gkjoktqm7od1' (mysql): INSERT INTO sessions (session_id, ip_address, user_agent, created, last_used, remember, data) VALUES ('hjdsshde79g29soelaqsnficj6fkb4gdpgdh9271gkjoktqm7od1', '::1', 'Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1', 1327281735, 1327281735, 0, '') 1062: Duplicate entry 'hjdsshde79g29soelaqsnficj6fkb4gdpgdh9271' for key 'sessions_pkey'

ADOConnection._Execute(INSERT INTO sessions
(session_id, ip_address, user_agent, created, last_used, remember, data)
VALUES
('hjdsshde79g29...) % line 845, file: adodb.inc.php
ADOConnection.Execute(INSERT INTO sessions
(session_id, ip_address, user_agent, created, last_used, remember, data)
VALUES
(?, ?, ?, ?, ?,..., Array[7]) % line 200, file: DAO.inc.php
DAO.update(INSERT INTO sessions
(session_id, ip_address, user_agent, created, last_used, remember, data)
VALUES
(?, ?, ?, ?, ?,..., Array[7]) % line 74, file: SessionDAO.inc.php
SessionDAO.insertSession(Object:Session) % line 82, file: SessionManager.inc.php
SessionManager.SessionManager(Object:SessionDAO, Object:Request) % line 114, file: SessionManager.inc.php

DB Error: Duplicate entry 'hjdsshde79g29soelaqsnficj6fkb4gdpgdh9271' for key 'sessions_pkey'
(mysql): UPDATE sessions SET user_id = NULL, ip_address = '::1', user_agent = 'Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1', created = 1327281735, last_used = 1327281735, remember = 0, data = '' WHERE session_id = 'hjdsshde79g29soelaqsnficj6fkb4gdpgdh9271gkjoktqm7od1'
"""
IDMsly
 
Posts: 8
Joined: Mon Jan 23, 2012 7:21 am

Re: DB Error: Duplicate entry XXX for key 'sessions_pkey'

Postby asmecher » Tue Jan 24, 2012 6:35 am

Hello IDMsly,

See for example http://lib-pkp2.lib.sfu.ca/support/forum/viewtopic.php?f=8&t=3006.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8470
Joined: Wed Aug 10, 2005 12:56 pm

Re: DB Error: Duplicate entry XXX for key 'sessions_pkey'

Postby IDMsly » Wed Jan 25, 2012 4:01 pm

I have tried several of the methods suggested but still have the same problem
. The stacktrace (this is on OCS) comes out as :-

DB Error: Duplicate entry 'psvcurd3blc78gbq0j3db9gqkh5umv8m111vijb1' for key 'sessions_pkey'
Stack Trace:
File: /srv/www/htdocs/ocs/lib/pkp/classes/session/SessionDAO.inc.php line 74
Function: DAO->update("INSERT INTO sessions (session_id, ip_address, user_agent, cr...", Array(7))

File: /srv/www/htdocs/ocs/lib/pkp/classes/session/SessionManager.inc.php line 82
Function: SessionDAO->insertSession(Object(Session))

File: /srv/www/htdocs/ocs/lib/pkp/classes/session/SessionManager.inc.php line 114
Function: SessionManager->SessionManager(Object(SessionDAO), Object(Request))

File: /srv/www/htdocs/ocs/classes/security/Validation.inc.php line 273
Function: SessionManager->getManager()

File: /srv/www/htdocs/ocs/lib/pkp/classes/core/PKPPageRouter.inc.php line 65
Function: Validation->isLoggedIn()

File: /srv/www/htdocs/ocs/lib/pkp/classes/core/Dispatcher.inc.php line 114
Function: PKPPageRouter->isCacheable(Object(Request))

File: /srv/www/htdocs/ocs/lib/pkp/classes/core/PKPApplication.inc.php line 170
Function: Dispatcher->dispatch(Object(Request))

File: /srv/www/htdocs/ocs/index.php line 65
Function: PKPApplication->execute()
IDMsly
 
Posts: 8
Joined: Mon Jan 23, 2012 7:21 am

Re: DB Error: Duplicate entry XXX for key 'sessions_pkey'

Postby IDMsly » Thu Jan 26, 2012 4:27 pm

Have tried using msyql trace on
As far as I can see the following mysql command is run the moment you enter the front page of the site and again when you try to log in.
INSERT INTO sessions (session_id, ip_address, user_agent, created, last_used, remember, data) VALUES ('17dvh4m1kmsg6aag71qaifr8817d11rd2egijin0tp66lsf6jqj1', '::1', 'Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1', 1327618688, 1327618688, 0, '')

It falls over the second time obviously because the key is already there.

Any further suggestions? | really would like to try to get this working
IDMsly
 
Posts: 8
Joined: Mon Jan 23, 2012 7:21 am

Re: DB Error: Duplicate entry XXX for key 'sessions_pkey'

Postby IDMsly » Fri Jan 27, 2012 3:24 pm

Troubles with OCS (same problems with OJS)
To continue the saga - it seems the sessions table uses the cookie number as primary key, but the system tries to insert this twice for some reason (ADO and DAO)
I tried altering the SessionsDAO to INSERT IGNORE instead of just INSERT. This at least gets me past the duplicate key error but leaves me at the login screen, and constantly cycling back to it - presumably because of further cookie problems caused by my change.
I have tried what I can find on the forum with regard to similar problems and changing the config file but no luck. I have tried Firefox, Opera, Konqueror and Chromium from the Linus machine carrying the software and Firefox from a Windows 7 machine on the same intranet, but the same problem each time.

help!
IDMsly
 
Posts: 8
Joined: Mon Jan 23, 2012 7:21 am

Re: DB Error: Duplicate entry XXX for key 'sessions_pkey'

Postby jmacgreg » Sat Jan 28, 2012 6:31 pm

Hi there,

Have you tried clearing your user sessions from the Site Administrator interface? What about checking your server's error log?

Cheers,
James
jmacgreg
 
Posts: 4186
Joined: Tue Feb 14, 2006 10:50 am

Next

Return to OJS Technical Support

Who is online

Users browsing this forum: Yahoo [Bot] and 4 guests