Zen Cart Logo
Forums / General Questions / Duplicate entry for key insert into sessions

Duplicate entry for key insert into sessions

Views: 2,336

Results 1 to 13 of 13
29 Apr 2013, 4:54 PM
#1
rcwebdev avatar

rcwebdev

New Zenner

Join Date:
Nov 2012
Posts:
27
Plugin Contributions:
0

Duplicate entry for key insert into sessions

I hope somebody can help me figure out what is going on.

I am getting the fatal error below. The store has been running for a couple of months, but I just I started seeing this error last week (twice) after I was prompted in admin to clear the activity logs and cleared them, but I don't see how this problem could be related. I also added images to the store and updated the products using EasyPopulate.

Any help would be greatly appreciated.

PHP Fatal error: 1062:Duplicate entry '8340eefadcffec0bed57ed979efd37a7' for key 'PRIMARY' :: insert into xx_sessions
values ('8340eefadcffec0bed57ed979efd37a7', '1366913351', 'c2VjdXJpdHlUb2tlbnxzOjMyOiI3YTkwZTk0YTQzNDFiMmFmNWIxYzI5YjUwOTgwNDk0YSI7Y3VzdG9tZXJzX2hvc3RfYWRkcmVzc3xzOjQ3OiIxNzMtOS02MS0yNDEtTmV3RW5nbGFuZC5oZmMuY29tY2FzdGJ1c2luZXNzLm5ldCI7Y2FydElEfHM6MDoiIjtjYXJ0fE86MTI6InNob3BwaW5nQ2FydCI6Nzp7czo4OiJjb250ZW50cyI7YTowOnt9czo1OiJ0b3RhbCI7aTowO3M6Njoid2VpZ2h0IjtpOjA7czoxMjoiY29udGVudF90eXBlIjtiOjA7czoxODoiZnJlZV9zaGlwcGluZ19pdGVtIjtpOjA7czoyMDoiZnJlZV9zaGlwcGluZ193ZWlnaHQiO2k6MDtzOjE5OiJmcmVlX3NoaXBwaW5nX3ByaWNlIjtpOjA7fW5hdmlnYXRpb258TzoxNzoibmF2aWdhdGlvbkhpc3RvcnkiOjI6e3M6NDoicGF0aCI7YToxOntpOjA7YTo0OntzOjQ6InBhZ2UiO3M6MTI6InByb2R1Y3RfaW5mbyI7czo0OiJtb2RlIjtzOjM6IlNTTCI7czozOiJnZXQiO2E6Mjp7czo1OiJjUGF0aCI7czoxOiIxIjtzOjExOiJwcm9kdWN0c19pZCI7czozOiIxOTkiO31zOjQ6InBvc3QiO2E6MDp7fX19czo4OiJzbmFwc2hvdCI7YTo0OntzOjQ6InBhZ2UiO3M6MTI6InByb2R1Y3RfaW5mbyI7czo0OiJtb2RlIjtzOjM6IlNTTCI7czozOiJnZXQiO2E6Mjp7czo1OiJjUGF0aCI7czoxOiIxIjtzOjExOiJwcm9kdWN0c19pZCI7czozOiIxOTkiO31zOjQ6InBvc3QiO2E6MDp7fX19Y2hlY2tfdmFsaWR8czo0OiJ0cnVlIjtsYW5ndWFnZXxzOjc6ImVuZ2xpc2giO2xhbmd1YWdlc19pZHxzOjE6IjEiO2xhbmd1YWdlc19jb2RlfHM6MjoiZW4iO2N1cnJlbmN5fHM6MzoiVVNEIjt0b2RheV9pc3xzOjEwOiIyMDEzLTA0LTI1Ijt1cGRhdGVFeHBpcmF0aW9uc3xiOjE7c2Vzc2lvbl9jb3VudGVyfGI6MTtjdXN0b21lcnNfaXBfYWRkcmVzc3xzOjEyOiIxNzMuOS42MS4yNDEiOw==') in /home/vg011web01/41/75/1017541/web/store/includes/classes/db/mysql/query_factory.php on line 120

I am running Zen Cart 1.5.1, with UPS shipping module, Sage Payment Module, TaxCloud.

29 Apr 2013, 7:24 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Duplicate entry for key insert into sessions

Ask your host what changes they've made to PHP versions or PHP configuration settings lately.

And, go to Admin->Tools->Server Info and post everything from that page here, mainly the PHPInfo settings.

30 Apr 2013, 11:33 AM
#3
rcwebdev avatar

rcwebdev

New Zenner

Join Date:
Nov 2012
Posts:
27
Plugin Contributions:
0

Re: Duplicate entry for key insert into sessions

Thank you for getting back to me.

What sections of the PHP.INI file should I post? For security reasons, I don't want to post all the settings, or I could edit paths, IPs, domain, ports.

Thank you again.

30 Apr 2013, 5:27 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Duplicate entry for key insert into sessions

Yours probably has:
session.hash_function = sha512

but changing it to the original setting of 1 should avoid that issue:
session.hash_function = 1

or you could try the even older setting of 0 .... both will work fine with ZC

.

1 May 2013, 6:24 PM
#5
rcwebdev avatar

rcwebdev

New Zenner

Join Date:
Nov 2012
Posts:
27
Plugin Contributions:
0

Re: Duplicate entry for key insert into sessions

Thanks for getting back to me.

It was set to 0. The session settings are included below. I set it to session.hash_function = 1 in PHP.INI

You probably know this, but I looked it up and include it here for others that may want to know '0' means MD5 (128 bits) and '1' means SHA-1 (160 bits).

When made the change, it was very slow to login, and I couldn't get a UPS shipping quote returned from UPS. Maybe something to do with creating a session? When I tried set it back to 0, the UPS shipping quote worked again. When I tried this I hadn't been previously logged in, so there wasn't a stored session, and I did try closing my browser and logging in to the store again too a few times.

Here's my session info

session
Session Support enabled
Registered save handlers files user sqlite
Registered serializer handlers php php_binary wddx

Directive Local Value Master Value
session.auto_start Off Off
session.bug_compat_42 On On
session.bug_compat_warn On On
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain thedomain.com no value
session.cookie_httponly On Off
session.cookie_lifetime 0 0
session.cookie_path /the_store_name/the_admin_folder /
session.cookie_secure On Off
session.entropy_file no value no value
session.entropy_length 0 0
session.gc_divisor 2 100
session.gc_maxlifetime 900 1440
session.gc_probability 1 1
session.hash_bits_per_character 4 4
session.hash_function 0 0
session.name zenAdminID PHPSESSID
session.referer_check no value no value
session.save_handler user files
session.save_path /web/the_store_name/cache /var/lib/php5
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies On On
session.use_trans_sid 0 0

Thank you again!!!
RC

1 May 2013, 6:55 PM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Duplicate entry for key insert into sessions

0 is an acceptable setting also. (to clarify, I've updated my previous post to reflect that.)

Have you been able to establish any pattern of steps which specifically causes the error to be triggered?

1 May 2013, 8:45 PM
#7
rcwebdev avatar

rcwebdev

New Zenner

Join Date:
Nov 2012
Posts:
27
Plugin Contributions:
0

Re: Duplicate entry for key insert into sessions

Sorry I see you said 0 is ok too.

I don't have any pattern yet.

Thanks

2 May 2013, 11:21 AM
#8
rcwebdev avatar

rcwebdev

New Zenner

Join Date:
Nov 2012
Posts:
27
Plugin Contributions:
0

Re: Duplicate entry for key insert into sessions

Dr. Byte.

I'm thinking it's possible this error came up caused by reloading payment pages. We had an issue a few weeks ago where payments were being declined. In trying to test an error message, I had refreshed the page this may have triggered the error. A customer had a problem paying recently and that error was in the log. Perhaps they also reloaded the page. Does that sound plausible to you too?

Another problem were are having is sometimes the UPS shipping rates come back with
and an error We are unable to obtain a rate quote for UPS shipping.. This causes a warning in the log "*PHP Warning: Invalid argument supplied for foreach() in includes/modules/pages/checkout_shipping/header_php.php *

I had thought the UPS issue might be a temporary server connection problem since, reloading the page or hitting continue causes the rates to come up, or getting out of the page and coming back to it often fixes the problem. Do you think these two issue could be related?

Thank you again.

2 May 2013, 8:12 PM
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Duplicate entry for key insert into sessions

RCwebdev:

I had thought the UPS issue might be a temporary server connection problem since, reloading the page or hitting continue causes the rates to come up, or getting out of the page and coming back to it often fixes the problem. Do you think these two issue could be related?
Sometimes rate-quote servers like the UPS server might have a temporary communications glitch, thus causing the "we couldn't get rates" message.
Isn't related to any sessions issue though.

2 May 2013, 8:39 PM
#10
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Duplicate entry for key insert into sessions

RCwebdev:

Another problem were are having is sometimes the UPS shipping rates come back with
and an error We are unable to obtain a rate quote for UPS shipping.. This causes a warning in the log "*PHP Warning: Invalid argument supplied for foreach() in includes/modules/pages/checkout_shipping/header_php.php *
That PHP Warning should not happen when using the latest UPS module at http://www.zen-cart.com/downloads.php?do=file&id=1293
I can't speak for other modules, but this one specifically avoids triggering that "invalid argument for foreach" problem even when server communications fails.

3 May 2013, 2:21 PM
#11
rcwebdev avatar

rcwebdev

New Zenner

Join Date:
Nov 2012
Posts:
27
Plugin Contributions:
0

Re: Duplicate entry for key insert into sessions

Thanks for this info.

Do you have any thoughts on what could trigger the error? No other shipping options are offered by my client.

3 May 2013, 4:24 PM
#12
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Duplicate entry for key insert into sessions

Not without more details about the specific pattern of events which triggers the message. Hard to diagnose if the symptoms can't be triggered on-demand.
More information needed. Perhaps server access logs might reveal what IP address and UserAgent and Referrer triggered the errors based on matching up the timestamps, along with comparing the previous and subsequent 100 or so log entries.

20 Aug 2013, 7:22 AM
#13
jetx avatar

jetx

Zen Follower

Join Date:
Apr 2006
Posts:
425
Plugin Contributions:
0

Re: Duplicate entry for key insert into sessions

[01-Aug-2013 09:49:38 UTC] PHP Fatal error: 1062:Duplicate entry 'f9f6562a73eedb7c450b9a79d5ee3300' for key 'PRIMARY' :: insert into sessions
values ('f9f6562a73eedb7c450b9a79d5ee3300', '1375352018', 'c2VjdXJpdHlUb2tlbnxzOjMyOiJmOTdlZjg2MThlMDRjNDZiMzAzMzMyOGUxNzczYmI2NiI7Y3VzdG9tZXJzX2hvc3RfYWRkcmVzc3xzOjQ1OiJDUEUtMTIwLTE0Ni0xMzctMTA3LnN0YXRpYy5uc3cuYmlncG9uZC5uZXQuYXUiO2NhcnRJRHxzOjA6IiI7Y2FydHxPOjEyOiJzaG9wcGluZ0NhcnQiOjc6e3M6ODoiY29udGVudHMiO2E6MDp7fXM6NToidG90YWwiO2k6MDtzOjY6IndlaWdodCI7aTowO3M6MTI6ImNvbnRlbnRfdHlwZSI7YjowO3M6MTg6ImZyZWVfc2hpcHBpbmdfaXRlbSI7aTowO3M6MjA6ImZyZWVfc2hpcHBpbmdfd2VpZ2h0IjtpOjA7czoxOToiZnJlZV9zaGlwcGluZ19wcmljZSI7aTowO31uYXZpZ2F0aW9ufE86MTc6Im5hdmlnYXRpb25IaXN0b3J5IjoyOntzOjQ6InBhdGgiO2E6MTp7aTowO2E6NDp7czo0OiJwYWdlIjtzOjU6ImluZGV4IjtzOjQ6Im1vZGUiO3M6NjoiTk9OU1NMIjtzOjM6ImdldCI7czowOiIiO3M6NDoicG9zdCI7YTowOnt9fX1zOjg6InNuYXBzaG90IjthOjA6e319Y2hlY2tfdmFsaWR8czo0OiJ0cnVlIjtsYW5ndWFnZXxzOjc6ImVuZ2xpc2giO2xhbmd1YWdlc19pZHxzOjE6IjEiO2xhbmd1YWdlc19jb2RlfHM6MjoiZW4iO2N1cnJlbmN5fHM6MzoiQVVEIjt0b2RheV9pc3xzOjEwOiIyMDEzLTA4LTAxIjt1cGRhdGVFeHBpcmF0aW9uc3xiOjE7c2Vzc2lvbl9jb3VudGVyfGI6MTtjdXN0b21lcnNfaXBfYWRkcmVzc3xzOjE1OiIxMjAuMTQ2LjEzNy4xMDciOw==') in /home/.../includes/classes/db/mysql/query_factory.php on line 120

I have had this fatal error twice so far this month, on the 1st and 19th. Looking at the server logs (matching date and times) I cannot see anything unusual except that on both occasions the user agent: Mozilla/5.0 (iPad; CPU OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B141 Safari/8536.25

Which is IOS 6, ipad I believe.

At this stage I am not really sure where to look to find answers. One user was looking at gallery pics (an easy page), one was viewing products.