? Pending

User tests: Successful: Unsuccessful:

avatar mbabker
mbabker
3 Dec 2016

Summary of Changes

This is only the changes for the database session storage from #10905

  • Right now, JSessionStorageDatabase::write() depends on the application having inserted a record into the #__session database table to work correctly, the method is changed to query for the presence of the record first and to be able to insert it if not already present
  • Garbage collection in PHP's session module happens when the session is started. Instead of running this cleanup operation at the beginning of the request cycle, we'll catch that garbage collection has been requested and run this when the session is closed at the end of the request cycle. This defers the cleanup operation to a point after the user should have gotten the HTML response instead of this cleanup being a blocking operation (at least for the default database handler).
  • Try to explicitly initialize the database connection when the session is opened instead of waiting for the connection to be lazy started; the only practical benefit here is if there is a database connection issue the error is raised sooner
  • A session handler's read() method should always return a string, so if an exception is caught in JSessionStorageDatabase::read() we'll return an empty string instead of a boolean false now

Testing Instructions

Sessions using the database storage should continue to work correctly

Documentation Changes Required

N/A

avatar mbabker mbabker - open - 3 Dec 2016
avatar mbabker mbabker - change - 3 Dec 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 3 Dec 2016
Category Libraries
avatar mbabker mbabker - change - 3 Dec 2016
Labels Added: ?
avatar dgt41
dgt41 - comment - 3 Dec 2016

@mbabker is there any noticeable improvement in the response times?

avatar mbabker
mbabker - comment - 3 Dec 2016

TBH, probably not. The one thing that might make a difference is moving garbage collection to a point after the HTML response should have been sent, but really its only a single DELETE query we're talking about here.

Symfony does this in part (see symfony/symfony#10908) to allow their handler to use locking mechanisms and transactions. So it honestly doesn't hurt us much, but at the same time it's probably not extremely beneficial either.

avatar andrepereiradasilva
andrepereiradasilva - comment - 13 Dec 2016

with this patch applied when using shared sessions i cannot logout

avatar andrepereiradasilva
andrepereiradasilva - comment - 18 Dec 2016

@mbabker any idea why i could'nt log out in shared sessions afte this patch? (add to manually delete the cookie to logout)

avatar mbabker
mbabker - comment - 18 Dec 2016

Not a clue. Nothing in the database session handler is client aware, including shared sessions.

avatar mbabker
mbabker - comment - 18 Dec 2016

Found it. The issue is unrelated to this patch.

avatar mbabker
mbabker - comment - 18 Dec 2016

See #13273

The branch at https://github.com/mbabker/joomla-cms/tree/logout-database-sessions combines these two PRs for convenience.

avatar andrepereiradasilva
andrepereiradasilva - comment - 19 Dec 2016

I have tested this item successfully on 939278c

Tested both #13273 and #13075 applied in the patchtester.
Tested with shared and non shared session both login and logout from admin and site client
all worked fine. so works as described


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13075.

avatar andrepereiradasilva andrepereiradasilva - test_item - 19 Dec 2016 - Tested successfully
avatar csthomas
csthomas - comment - 20 Dec 2016

I have tested this item successfully on 939278c

The same as above.
Tested both #13273 and #13075 applied in the patchtester.
Tested with shared and non shared session both login and logout from admin and site client
all worked fine.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13075.

avatar csthomas csthomas - test_item - 20 Dec 2016 - Tested successfully
avatar zero-24 zero-24 - change - 20 Dec 2016
Milestone Added:
avatar zero-24 zero-24 - change - 20 Dec 2016
Milestone Added:
Status Pending Ready to Commit
Labels Added: ?
avatar csthomas
csthomas - comment - 21 Dec 2016

One warning.
When I have applied this PR then on backend "Logged-in Users" module does not work.
Session on database, not shared and shared session.

Can anybody confirm?

avatar zero-24
zero-24 - comment - 21 Dec 2016

When I have applied this PR then on backend "Logged-in Users" module does not work.
Session on database, not shared and shared session.

Can you double check that you have the very last chnages from staging?

avatar csthomas
csthomas - comment - 21 Dec 2016

I have checked again and the same result.
Applied by patch tester and by git as:
curl https://patch-diff.githubusercontent.com/raw/joomla/joomla-cms/pull/13075.diff | git apply

After I applied then Logged Users module is empty after relogin as admin.
When I do checkout and relogin then module show me again.

joomla_3.7-dev

avatar csthomas
csthomas - comment - 21 Dec 2016

With this PR in table #__sessions username and guest column is always empty.

avatar rdeutz
rdeutz - comment - 4 Jan 2017

I have tested this item ? unsuccessfully on 939278c

Same result as @csthomas after logout and login the "LOGGED-IN USERS" List is empty


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13075.

avatar rdeutz rdeutz - test_item - 4 Jan 2017 - Tested unsuccessfully
avatar rdeutz rdeutz - change - 4 Jan 2017
Status Ready to Commit Pending
Labels
avatar mbabker
mbabker - comment - 4 Jan 2017

I can't say I care enough to dig into why this issue is occurring because zero changes are made anywhere which can cause it. So, sorry for wasting time.

avatar mbabker mbabker - change - 4 Jan 2017
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2017-01-04 20:15:39
Closed_By mbabker
avatar mbabker mbabker - close - 4 Jan 2017
avatar rdeutz
rdeutz - comment - 4 Jan 2017

This is the reason why we having tests, to find the issues that can't occurring because nothing is changed

Add a Comment

Login with GitHub to post a comment