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.

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

Postby IDMsly » Sun Jan 29, 2012 8:22 am

[Sun Jan 29 15:05:10 2012] [error] [client ::1] ocs2: DB Error: Duplicate entry 'rl2r4a0uiai4ealbf8a9avtj8273oqnhkhdt2jpu' for key 'sessions_pkey', referer: http://localhost/ocs/

As far as I can see from the rest of the stuff I have copied above two procedures 'ADOConnection._Execute' and 'DAO.update' both seem to try to enter the same data into the sessions database table. Without looking into the depths of the code I do not know whether this is the cause or one is called from the other or what each is supposed to do.
IDMsly
 
Posts: 8
Joined: Mon Jan 23, 2012 7:21 am

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

Postby IDMsly » Sun Jan 29, 2012 2:05 pm

I presume you mean the OCS System Administrator interface? As said it is impossible to log on the system at all because of this problem. The machine is one of two networked at home. I can and have emptied the sessions tables using webmin

The Apache error log merely shows '[error] [client ::1] ocs2: DB Error: Duplicate entry 'rl2r4a0uiai4ealbf8a9avtj8273oqnhkhdt2jpu' for key 'sessions_pkey', referer: http://localhost/ocs/'

As far as I can see from the rest of the stuff I have copied above two procedures 'ADOConnection._Execute' and 'DAO.update' both seem to try to enter the same data into the sessions database table. Without looking into the depths of the code I do nto know whether this is the cause or one is called from the other.
IDMsly
 
Posts: 8
Joined: Mon Jan 23, 2012 7:21 am

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

Postby asmecher » Sun Jan 29, 2012 2:26 pm

Hi IDMsly,

Did you check your session.auto_start setting in the php.ini configuration file? If it's turned on, it needs to be disabled.

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

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

Postby IDMsly » Sun Jan 29, 2012 3:34 pm

jmacgreg wrote:Hi there,

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

Cheers,
James



No access at all to OCS (or OJS) systems, have to clear using webmin. Apache server log show only the duplicate key arror.
IDMsly
 
Posts: 8
Joined: Mon Jan 23, 2012 7:21 am

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

Postby IDMsly » Mon Jan 30, 2012 4:20 pm

Yes, saw that point early on, checked and it is off copy of settings
[Session]

session.save_handler = files
session.save_path = "/var/lib/php5"
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.bug_compat_42 = Off
session.bug_compat_warn = Off
session.referer_check =
session.entropy_length = 32
session.entropy_file = /dev/urandom
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = sha256
session.hash_bits_per_character = 5

What it looks like from the error messages is that the PHP databse function ADOConnection._Execute and the your DAO.update(INSERT INTO sessions do the same thing and clash because they both use the same primary key in the same table. It may be that the one calls/uses the other but it still looks like a clash just from the printout
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 31, 2012 10:17 am

Hi IDMsly,

If you're looking at a stack trace, then I suspect you're probably seeing the same statement twice because it's getting passed deeper into the call stack. I strongly suspect what you're looking at is some kind of platform configuration issue -- if it was purely a coding bug, then we'd have more reports of it -- so I'd suggest simplifying your setup as much as you can to see if you can isolate the problem.

Is there caching, proxying, or anything similar that you can disable?
Are you using any PHP opcode compilers that might be interfering?

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

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

Postby sajith » Mon Apr 30, 2012 3:17 am

I'm also getting the same error(DB Error: Duplicate entry 'ofrjodj9joljmc3sr29m9id6u6ms0mpo3pvmjes3' for key 'sessions_pkey') while working in Linux Open suse. But I didn't get any error in windows. Please any one help me to solve this problem.
sajith
 
Posts: 1
Joined: Mon Apr 30, 2012 3:11 am

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

Postby dang » Fri May 04, 2012 12:23 am

Hi,

OJS is generating your session id using MD5 hash funtion, but yout php is using a sha256 hash.
So, the solution is to change in your php.ini session.hash_function=sha256 to session.hash_funtion=0 (corresponding to MD5) or to session.hash_function= 1(corresponding to sha1), but in the last case, you have to change the OJS config file (encryption = md5 to encryption = sha1).
After all these, restart apache, delete your ojs cookie and refresh the page.

Hope this help.
dang
 
Posts: 1
Joined: Fri May 04, 2012 12:07 am

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

Postby hlx » Thu Jan 31, 2013 5:31 am

Hi IDMsly,

I have exacltly the same problems: I can't do any login after installation because of

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

I use SuSE 12.2 environment.

I tried to repeat the installation of ocs 2.3.5 on an older SuSE (11.3) and this installation works perfectly - including first login and session stuff.

I fear the solution of our problem has to do with php-session parameters in php5/apache/php.ini but I am not sure which. Changing of these params (like session.entropy_length) is not a good idea without knowing exactly what I do.

Does anyone else has an idea?
I also need a working installation on a recent SuSE...
hlx
 
Posts: 1
Joined: Thu Jan 31, 2013 5:20 am

Previous

Return to OJS Technical Support

Who is online

Users browsing this forum: Baidu [Spider] and 6 guests