Closed (fixed)
Project:
AJAX Comments
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
20 Feb 2013 at 03:18 UTC
Updated:
5 Nov 2013 at 09:00 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
flocondetoileI have the same problem. I use nginx with microcaching and if an anonymous user post a comment, then a cookie SESS is store in the browser and then all pages are no longer cached.
A workaround is to cache the pages for the authenticated users too (who have the SESSION cookie) but not really satisfactory.
The same problem must also occur with Varnish in front of the site.
Comment #2
flocondetoileI disabled Ajax comment module and cookies session are always store in the browser.
It seems then that the cookie is stored by an another module
@loparr : have you the module comment notify installed ?
Comment #3
loparr commentedExactly that hapened to me. Session now is stored ALLWAYS, no matter what. I ended up recreating whole new site. Comments now works without creating session if you do not use ajax comments module. So the problem must have been in some other module but I do not want to find it by turning on and off every single module.
No I do not use comment notify. Instead I use simple rules for sending email to admin.
Comment #4
flocondetoileI tested on a new drupal site installation, with only ajax comment.
It seems that the drupal session cookie is well in fact generated and stored by Ajax Comment. On this new site, when i disabled it, the session cookie is no longer stored.
But i don't understand why on my site, when i disable ajax comment, the session cookie is always stored in my browser. I clear the cache, uninstall the module, etc without effects.
Edit : in fact, the session cookie is deleted after 10 minutes
Comment #5
loparr commentedI tracked this problem to flush page cache module see here http://drupal.org/node/1925398
Comment #6
flocondetoileHello,
Here is the status of my research and testing on this problem
1 - On a fresh install of Drupal, no module installed, submission of comments does not create cookie
2 - Ajax_comment creates a session cookie when activated
3 - After the module is disabled, session cookies continue to be created after submitting comment
For point 3
In fact a session cookie is created if the parameter (configuration / performance) miminum Cache lifetime is set to a time value. The session cookie is deleted after the time set in this parameter. This should be a normal behavior Drupal ? (which I had not noticed, but this is the first time I use Nginx microcache in front of my site Drupal)
For point 2, I don't know if it is an obligation or behavior that you can change if you want to use Ajax_Comment without using a session cookie.
In my case, I use nginx with microcache set to 60s. If it's necessary to keep the session cookie for Ajax_comments, then the ideal would be to set, with the module settings, the expiration time of the session cookie. For example 60s.
With this setting, when an anonymous visitor post a comment, he gets a session cookie for a period of 60s, and then can see his comment on the page because with the session cookie he bypass the cache nginx (or varnish). After this time, the cookie is deleted and then the visitor gets the cached page, but this page will be regenerated as the microcache is set to 60s.
Attached a patch (this is my first patch, be indulgent;-)) that implements this functionality (on only function submit a comment)
@Loparr : in my case I do not use flush page cache module.
Comment #7
olli commented@flocondetoile: I skimmed through the code and did not see a point where it should set a session, but noticed a bug when it tries to remove messages from session.
Comment #8
muschpusch commentedThere was some code which passed a value by SESSION to a function but that is removed a while ago...
Comment #9
olli commentedHi @muschpusch,
I dont know if that could be related since I tried this with a fresh clone.
Current code removes all status messages if any of those three messages are found, but it leaves an empty messages array in $_SESSION. After applying the patch, only those three messages are removed and $_SESSION is cleaned up.
Comment #10
muschpusch commentedCould you use drupal_get_messages instead of the two if's?
Comment #11
olli commentedThanks for the review.
Do you mean these two?
I don't know how to do that with drupal_get_messages().
Comment #12
muschpusch commentedHey, it's easier than you think :)
drupal_get_messages($type = 'status');
Here is what drupal_get_message does (more or less the same if / if code you had)
Comment #13
olli commentedPlease, correct me if I'm wrong about this. That function would clear/unset the messages unconditionally while we want to clean up only if we've unset the last status message (in the foreach loop above our if/if code), right?
Comment #14
muschpusch commentedSorry i was confused... Your patch got committed!