Jump to content
Latest News: (loading..)
greasemonkey

Failed to Decode Sessions Object and Cannot Modify Header Errors

Recommended Posts

Hey All, I'm having an intermittent issue, under heavy traffic (happened this weekend just after our Black Friday newsletter) where I'm seeing TONS of Sessions errors:

Running a 2.3.4 (mostly updated to EDGE)....

The DB table for Sessions is InnoDB with utf8_unicode_ci...

My configuration, and config file settings are below:

Quote
Session Directory /home/****/public_html/includes/work/  
Force Cookie Use False  
Check SSL Session ID False  
Check User Agent False  
Check IP Address False  
Prevent Spider Sessions True  
Recreate Session True  
 
  define('STORE_SESSIONS', 'mysql');
Quote

[23-Nov-2018 13:11:14 America/Toronto] PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/****/public_html/includes/functions/sessions.php:97) in /home/****/public_html/includes/functions/general.php on line 52
[23-Nov-2018 13:11:15 America/Toronto] PHP Warning:  session_start(): Failed to decode session object. Session has been destroyed in /home/****/public_html/includes/functions/sessions.php on line 97
[23-Nov-2018 13:11:15 America/Toronto] PHP Warning:  session_start(): Cannot send session cache limiter - headers already sent (output started at /home/****/public_html/includes/functions/sessions.php:97) in /home/****/public_html/includes/functions/sessions.php on line 97

These above errors are repetitive... and caused my error_log to blow up to over 7mb in 12 hours... almost 30,000 lines.

I used a DB optimizer addon cron - so my sessions table only (currently) has a little more than 400 records.

Doing a little research, I cannot see anyone with the same obvious problem - except maybe this note:

I don't have a timezone defined in my config files - and I find it very unlikely the issue was/is multibyte emjoi characters.

The only thing I have come up with is - I've seen a couple people mention on stackoverflow about making sure the DB column is large enough. Its currently set to Varchar(128).

I do see, plans to increase the length to the column to 255 in 2.4...

Any guesses???????

 

Edited by burt
Remove Admin URL

Share this post


Link to post
Share on other sites

@greasemonkey

Session Directory/home/****/public_html/includes/work/

Is that your actual directory? Or, did you just edit these out ...

/home/****/public_html/<domain>/catalog/includes/work

M


If you are running the "official" osC 2.3.4 or 2.3.4.1 download, your installation is obsolete! Get the latest community-supported responsive "Frozen" release here

Share this post


Link to post
Share on other sites
1 minute ago, ArtcoInc said:

@greasemonkey


Session Directory/home/****/public_html/includes/work/

Is that your actual directory? Or, did you just edit these out ...

/home/****/public_html/<domain>/catalog/includes/work

M

I've just edited out my domain...

Share this post


Link to post
Share on other sites
54 minutes ago, greasemonkey said:

headers already sent

That warning is usually due to extra spaces in a file but it can also be due to text being printed by the code. If this only happened when the site was busy, then my guess is that the server was failing with too  many connections and that message was being displayed, or something like that.

If it is always happening, then it is probably something in the code. In that case, I suggest clearing the error log file and clicking around your site, periodically checking the error log to see if a failure occurred.

You can also try changing the error_reporting line in includes/application_top.php to the following:

  error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_DEPRECATED);
  ini_set('display_errors','0'); 

 

Share this post


Link to post
Share on other sites

Empty, Optimise, Repair the sessions table.  Then;

Make the field a text field.  A text field can hold loads of data.

I suspect the session object stored in the DB is being truncated.


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites
8 minutes ago, burt said:

Empty, Optimise, Repair the sessions table.  Then;

Make the field a text field.  A text field can hold loads of data.

I suspect the session object stored in the DB is being truncated.

I agree... what’s the benefit of text column vs increasing to varchar 255?

Share this post


Link to post
Share on other sites

First of all, don't worry about the "headers already sent" messages. Fix the underlying cause ("failed to decode session object") and those will go away. In your code, what's at /includes/functions/sessions.php line 97? Something at or near that line is outputting to the browser well before any HTML is expected. It could be an error message, an extra space or Byte Order Marker (especially at the beginning or end of the code), some hacker code, whatever. If it's an error message, you may be able to see it if you look at the HTML page source in the browser (usually Ctrl+U). Possibly your server is sagging under the load and it's pumping out error messages, which, coming before all the headers have been sent, are causing a cascade of problems.


If you are running the "official" osC 2.3.4 or 2.3.4.1 download, your installation is obsolete! Get (stable) Frozen or (unstable) Edge. See also the naming convention and the latest community-supported responsive "Edge" release

Share this post


Link to post
Share on other sites
18 hours ago, MrPhil said:

First of all, don't worry about the "headers already sent" messages.

@MrPhilYes I wasn't... figured it was a cascading effect. My sessions function file matches Gold (this could be an issue... see below)....

I have done as @burt suggested, emptied, optimized and repaired the table - and have changed sesskey from varchar 128 to 255 (as it is in 2.4 Joli).

I will monitor over the next few weeks - although I'm not expecting any huge rush of traffic for the neat future........

Looking more deeply, there have been some changes to includes/functions/sessions from Gold (where my file base started) to Frozen/EDGE that I have not kept up to date. Many the change from $HTTP_COOKIE_VARS to $_COOKIE which I presume could???? make a difference????

 

Edited by greasemonkey

Share this post


Link to post
Share on other sites

If it still happens after cleaning/changing the DB...the root cause needs to be found.

I don't recall ever being contacted about anything similar (not by emai or at github), so it can't be a widespread issue.


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites
1 hour ago, greasemonkey said:

@MrPhilYes I wasn't... figured it was a cascading effect.

I just get a little peeved at people who should know better, but don't trim out the noise surrounding/after the real bug. It's OK to mention that there were "a bunch of 'Headers already sent' messages", but to clog up the forum with unnecessary cut and paste is annoying to have to read through. Also, one copy of a real bug line with "this was repeated many times" is much better than cut & paste 500 lines of repetitions like some neophytes do. Grrr.

I need another cuppa joe.


If you are running the "official" osC 2.3.4 or 2.3.4.1 download, your installation is obsolete! Get (stable) Frozen or (unstable) Edge. See also the naming convention and the latest community-supported responsive "Edge" release

Share this post


Link to post
Share on other sites
21 hours ago, burt said:

If it still happens after cleaning/changing the DB...the root cause needs to be found.

I don't recall ever being contacted about anything similar (not by emai or at github), so it can't be a widespread issue.

Yes, I wouldn't expect it is a wide spread problem - like I said, I've only ever seen this a couple other times, and again it was under extremely high traffic volume. So far so good.... We will be sending out another newsletter in a few days which always gives a good boost to traffic - not like Black Friday & Cyber Monday however.

Here's a screen cap from my Cloudflare account showing the bandwidth use - triple normal....

 

 

bandwidth.jpg

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×