Into my site I enable spam and custom filter modules. When user create a node or submit a node into table {sessions}.session field there are serialized spam_form array. I check the problem and it's on modules/spam_node.inc file.

I remove it and problem desappair (i don't check node for spam, only comments). I think problem is into hook_nodeapi (this function don't check if node must be checked or not).

CommentFileSizeAuthor
#3 spam-712624.patch875 bytesmavimo
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gnassar’s picture

I'm not sure I understand the problem. Could you please give more detail as to what specifically you're seeing and what goes wrong?

mavimo’s picture

Hi gnassar, sorry for delay.

I have a drupal installation with this config:

  • Content type
    • Cont1
    • Cont2
  • Role
    • Role1
    • Role2
  • Permission
    • Role1: "bypass filters", "create Cont1", ...
    • Role2: "create Cont2"

When user with role1 create (or update) a Cont1 node, all information about this node is saved into {sessions} table. This node is very complex and into sessions i find approx 2Mb of data (really slow to read, write, ....). I analized spam module code and from first analysis the problem is into spam_node.inc. It call node_spam_scan function where put some data into $_SESSION['spam_form'], after that run spam_scan function. This function (if user have perm "bypass filters") run spam_log and return. After that function call there is not unsert($_SESSION['spam_form']);
and all data will be store into {sessions} table.

mavimo’s picture

Status: Active » Needs review
FileSize
875 bytes

Patch attached

mdorrell’s picture

This patch seems to be working for me. Can we get this placed in the next version?

Jeremy’s picture

Status: Needs review » Fixed

Nice catch, thanks! This affects all content types, not just nodes, so I've expanded the patch, added comments, and committed it:
http://drupal.org/cvs?commit=468982

gnassar’s picture

Title: Session have wrong data » Unnecessary session data being stored
Category: bug » task
Priority: Critical » Normal
Status: Fixed » Active

We actually throw a *lot* of session data around. The serialized form is probably the easiest to notice, because it's enormous. But we can probably get rid of quite a bit of this stuff.

Reclassifying as a normal "task," since the impact (after the patch -- nice work, mavimo and Jeremy) is not severe and does not cause execution errors.

AlexisWilke’s picture

gnassar,

Is there any cases where that session data is needed as a session? Couldn't that be saved in a global variable, simply? (global $_spam_spam_form;) Because session data is saved in the database, whether or not it gets deleted right after... and if it gets deleted right after, why keep it in the DB in the first place? It's dead slow...

Actually, it seems to me that if it is necessary as a session in a few cases, then those cases can save that data in the session as required and thus we'd not have that saved every single time as it is now!

Thank you.
Alexis

apaderno’s picture

Version: 6.x-1.0 » 6.x-1.x-dev
Issue summary: View changes
Status: Active » Closed (outdated)

I am closing this issue, since it's for a Drupal version no longer supported.