Welcome Guest, Not a member yet? Register   Sign In
large amounts of db_session data gets lost after redirect
#1

[eluser]stef25[/eluser]
I noticed that when I assign a large array of data to the db_session and perform a redirect, the data is unavailable on the target page.

When I test with one multidimensional array that contains 200 elements and each of those contains another 6 elements that are strings of max 10 words each, this data is unavailable. In the DB this is stored as about 50KB of data.

When I test with a similar array that has just 4 instead of 200 elements, the data IS available.

AFAIK this has nothing to do with the 4KB limit of cookies? I'm using the db_session to get around this limit.

What causes this?
#2

[eluser]bretticus[/eluser]
In these kind of situations, I find I have to go digging into the core code a little. It's kind of the trade off you pay for using a framework. And when that happens a debugger is invaluable. With a debugger, you can step through the code line by line. There are free and pay-for IDE's alike for doing this: Eclipse. Netbeans, Zend Studio, etc.

There are even pecl libraries for debugging on the command line.

On another note, should you be storing that much data in a session? What about leveraging some sort of op caching in memory instead? Perhaps APC or Memcached or many others.
#3

[eluser]WebsiteDuck[/eluser]
Are you storing any weird data?

CodeIgniter's session library makes use of PHP's serialize and unserialize, so you might look into data that breaks those functions.
#4

[eluser]stef25[/eluser]
"should you be storing that much data in a session"

Probably not Smile I found a way around it. Will try to debug a bit to see why this is happening.
#5

[eluser]Unknown[/eluser]
What was your resolution to this? I'm running CI 1.7.2 and I have session_data size of around 50k like you and I'm having the same issue types of issues. My resolution was to ditch CI's session and use this session library (http://www.matthewfedak.co.uk/session_hy...niter.html) .. seems to work but it's a bit slow ..
#6

[eluser]InsiteFX[/eluser]
You need to change the user_data in the session table!
Code:
-- --------------------------------------------------------------

--
-- Table structure for CodeIgniter ci_sessions.
--
DROP TABLE IF EXISTS `ci_sessions`;

CREATE TABLE IF NOT EXISTS  `ci_sessions` (
  `session_id`    varchar(40)           DEFAULT '0' NOT NULL,
  `ip_address`    varchar(16)           DEFAULT '0' NOT NULL,
  `user_agent`    varchar(120)                      NOT NULL,
  `last_activity` int(10)      unsigned DEFAULT 0   NOT NULL,
  `user_data`     text,
  PRIMARY KEY (`session_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;

-- -------------------------------------------------------------
--  `user_data` text,       COMMENT - maximum length of 65535 characters.
--  `user_data` mediumtext, COMMENT - maximum length of 16777215 characters.
--  `user_data` longtext,   COMMENT - maximum length of 4294967295 characters.

InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB