CodeIgniter Forums
Session:transient error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: Issues (https://forum.codeigniter.com/forumdisplay.php?fid=19)
+--- Thread: Session:transient error (/showthread.php?tid=67636)



Session:transient error - badger - 03-18-2017

My new site using ci312, php 533 and mysql5083 has been running perfectly (thanks to ci developers for a great product) for over 3 months. However, about once a week (max) a session error occurs as shown below. I don't understand why it is happening. The table has the correct indices
PRIMARY KEY (`id`), UNIQUE INDEX `ci_sessions_id_ip` (`id`, `ip_address`), INDEX `ci_sessions_timestamp` (`timestamp`).
Apart from this there are no other log entries. Any suggestions?
Many thanks,
Bill

ERROR - 03-17 22:08:44 --> Query error: Duplicate entry 'd5c0884d53d8ddd3d0a077ab6f7827491619506a' for key 1 - Invalid query: INSERT INTO `ci_sessions` (`id`, `ip_address`, `timestamp`, `data`) VALUES ('d5c0884d53d8ddd3d0a077ab6f7827491619506a', '93.107.38.150', 1489788524, '__ci_last_regenerate|i:1489788521;|a:2:{i:0;s:1:\"2\";i:1;s:4:\"2/40\";}pretrolley_page|s:4:\"2413\";previous_page|s:4:\"2413\";')
ERROR - 03-17 22:08:44 --> Severity: Warning --> Unknown: Failed to write session data (user). Please verify that the current setting of session.save_path is correct (/usr/local/pem/vhosts/141487/tmp/) Unknown 0


RE: Session:transient error - fmertins - 03-21-2017

Hi there, are you using blob or mediumblob for the "data" column? Please post your "desc" session table.


RE: Session:transient error - badger - 03-21-2017

(03-21-2017, 01:46 PM)fmertins Wrote: Hi there, are you using blob or mediumblob for the "data" column? Please post your "desc" session table.

Hi, thanks for taking the time to reply, i was beginning to think it was dead in the water.
#1. blob.
#2. the blob data in those instances where the error occurred were all very short. There are much longer blob entries in the table.
#3.I don't think it should make any difference but I just noticed that the engine is myisam whereas i normally use innodb
Many thanks, Bill

CREATE TABLE `ci_sessions` (
`id` VARCHAR(40) NOT NULL,
`ip_address` VARCHAR(45) NOT NULL,
`timestamp` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`data` BLOB NOT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `ci_sessions_id_ip` (`id`, `ip_address`),
INDEX `ci_sessions_timestamp` (`timestamp`)
)
COLLATE='latin1_swedish_ci'
ENGINE=MyISAM


RE: Session:transient error - badger - 03-21-2017

my apologies, I have just seen the error. the structure for codeigniter v3 has id of varchar(128). i hadn't changed it from v2.
sorry for wasting your time
Bill


RE: Session:transient error - Narf - 03-21-2017

Neither is your problem.

You have a UNIQUE instead of PRIMARY key on the id, ip_address fields.


RE: Session:transient error - badger - 03-21-2017

(03-21-2017, 03:04 PM)Narf Wrote: Neither is your problem.

You have a UNIQUE instead of PRIMARY key on the id, ip_address fields.

oh s..t, i really screwed it up. and everything was running so perfectly. let me hang my head in shame
Once again, many thanks. great product and the support is even better
Bill


RE: Session:transient error - badger - 03-21-2017

Ah, now I remember, the instructions say primary key on [id, ip_address] if sess_match_ip is true else primary key only on [id]. I have sess_match_ip to false because I found on android tablets on whcih the google web speed up setting is set to true ( i forget the name they use), the session is lost because the ip changes to a google assigned one. For that reason I had to go for sess_match_ip to false
Bill


RE: Session:transient error - badger - 03-21-2017

(03-21-2017, 03:50 PM)badger Wrote: Ah, now I remember, the instructions say primary key on [id, ip_address] if sess_match_ip is true else primary key only on [id]. I have sess_match_ip to false because I found on android tablets on whcih the google web speed up setting is set to true ( i forget the name they use), the session is lost because the ip changes to a google assigned one. For that reason I had to go for sess_match_ip to false
Bill

the "Data Saver" option in chrome