Bug #53598

Epic #55070: Workpackages

Epic #55065: WP: Overall System Performance (Backend and Frontend)

Bug #52949: Speed decrease since 4.5

Select/Delete fe_sessions twice per request

Added by Alexander Opitz about 6 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Should have
Category:
Code Cleanup
Target version:
-
Start date:
2013-11-13
Due date:
% Done:

100%

TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Requesting a page results in two validations of the fe_session. Also the ses_id changes (as there is nothing written to the fe_sessions table). So we send out a session cookie for nothing (See #42592).

One request (fully cached page):

"Connect","typo3@localhost on " 
"Query","SET NAMES utf8" 
"Query","SELECT @@SESSION.sql_mode" 
"Init DB","typo3_master" 
"Query","SELECT COUNT(*) FROM fe_sessions WHERE ses_id = 'a384c00da8f25f0e2520431737b2a2ad'" 
"Query","SELECT content,tstamp FROM fe_session_data WHERE hash = 'a384c00da8f25f0e2520431737b2a2ad'" 
"Query","SELECT * FROM fe_sessions,fe_users WHERE fe_sessions.ses_id = '59006c68d372d7bd4746114f7ea7437f'
                    AND fe_sessions.ses_name = 'fe_typo_user'
                    AND fe_sessions.ses_userid = fe_users.uid
                    AND (
                fe_sessions.ses_iplock = '192.168'
                OR fe_sessions.ses_iplock='[DISABLED]'
                )
                    AND fe_sessions.ses_hashlock=218779088
                     AND fe_users.disable=0 AND fe_users.deleted=0 AND (fe_users.starttime<=1384339898) AND (fe_users.endtime=0 OR fe_users.endtime>1384339898)" 
"Query","DELETE FROM fe_sessions WHERE ses_id = '59006c68d372d7bd4746114f7ea7437f'
                        AND ses_name = 'fe_typo_user'" 
"Query","SELECT * FROM fe_sessions,fe_users WHERE fe_sessions.ses_id = '59006c68d372d7bd4746114f7ea7437f'
                    AND fe_sessions.ses_name = 'fe_typo_user'
                    AND fe_sessions.ses_userid = fe_users.uid
                    AND (
                fe_sessions.ses_iplock = '192.168'
                OR fe_sessions.ses_iplock='[DISABLED]'
                )
                    AND fe_sessions.ses_hashlock=218779088
                     AND fe_users.disable=0 AND fe_users.deleted=0 AND (fe_users.starttime<=1384339898) AND (fe_users.endtime=0 OR fe_users.endtime>1384339898)" 
"Query","DELETE FROM fe_sessions WHERE ses_id = '59006c68d372d7bd4746114f7ea7437f'
                        AND ses_name = 'fe_typo_user'" 
"Query","SELECT * FROM fe_session_data WHERE hash = '59006c68d372d7bd4746114f7ea7437f'" 
"Query","SELECT pages.uid,sys_domain.redirectTo,sys_domain.redirectHttpStatusCode,sys_domain.prepend_params FROM pages,sys_domain WHERE pages.uid=sys_domain.pid
                        AND sys_domain.hidden=0
                        AND (sys_domain.domainName='typo3-master.sphinx.lan.pluspol.info' OR sys_domain.domainName='typo3-master.sphinx.lan.pluspol.info/')  AND pages.deleted=0 AND pages.hidden=0 AND pages.starttime<=1384339860 AND (pages.endtime=0 OR pages.endtime>1384339860)  AND NOT pages.t3ver_state>0 AND pages.doktype<200 AND (pages.fe_group='' OR pages.fe_group IS NULL OR pages.fe_group='0' OR FIND_IN_SET('0',pages.fe_group) OR FIND_IN_SET('-1',pages.fe_group)) LIMIT 1" 
"Query","SELECT * FROM pages WHERE pid=0 AND pages.deleted=0 AND pages.hidden=0 AND pages.starttime<=1384339860 AND (pages.endtime=0 OR pages.endtime>1384339860)  AND NOT pages.t3ver_state>0 AND pages.doktype<200 AND (pages.fe_group='' OR pages.fe_group IS NULL OR pages.fe_group='0' OR FIND_IN_SET('0',pages.fe_group) OR FIND_IN_SET('-1',pages.fe_group)) ORDER BY sorting LIMIT 1" 
"Query","SELECT * FROM pages WHERE uid=1 AND pages.deleted=0 AND pages.hidden=0 AND pages.starttime<=1384339860 AND (pages.endtime=0 OR pages.endtime>1384339860)  AND NOT pages.t3ver_state>0 AND pages.doktype<200 AND (pages.fe_group='' OR pages.fe_group IS NULL OR pages.fe_group='0' OR FIND_IN_SET('0',pages.fe_group) OR FIND_IN_SET('-1',pages.fe_group))" 
"Query","SELECT content FROM cf_cache_rootline WHERE identifier = '1__0_0_0' AND cf_cache_rootline.expires >= 1384339898 LIMIT 1" 
"Query","SELECT content FROM cf_cache_pagesection WHERE identifier = '1_222419149' AND cf_cache_pagesection.expires >= 1384339898 LIMIT 1" 
"Query","SELECT content FROM cf_cache_pages WHERE identifier = '7e7cf228cfa0c6c0892caf3f54dccaf7' AND cf_cache_pages.expires >= 1384339898 LIMIT 1" 
"Quit",

Second request (fully cached page):

"Connect","typo3@localhost on " 
"Query","SET NAMES utf8" 
"Query","SELECT @@SESSION.sql_mode" 
"Init DB","typo3_master" 
"Query","SELECT COUNT(*) FROM fe_sessions WHERE ses_id = '59006c68d372d7bd4746114f7ea7437f'" 
"Query","SELECT content,tstamp FROM fe_session_data WHERE hash = '59006c68d372d7bd4746114f7ea7437f'" 
"Query","SELECT * FROM fe_sessions,fe_users WHERE fe_sessions.ses_id = '6415d190c31aa288c97d15d46b540253'
                    AND fe_sessions.ses_name = 'fe_typo_user'
                    AND fe_sessions.ses_userid = fe_users.uid
                    AND (
                fe_sessions.ses_iplock = '192.168'
                OR fe_sessions.ses_iplock='[DISABLED]'
                )
                    AND fe_sessions.ses_hashlock=218779088
                     AND fe_users.disable=0 AND fe_users.deleted=0 AND (fe_users.starttime<=1384340298) AND (fe_users.endtime=0 OR fe_users.endtime>1384340298)" 
"Query","DELETE FROM fe_sessions WHERE ses_id = '6415d190c31aa288c97d15d46b540253'
                        AND ses_name = 'fe_typo_user'" 
"Query","SELECT * FROM fe_sessions,fe_users WHERE fe_sessions.ses_id = '6415d190c31aa288c97d15d46b540253'
                    AND fe_sessions.ses_name = 'fe_typo_user'
                    AND fe_sessions.ses_userid = fe_users.uid
                    AND (
                fe_sessions.ses_iplock = '192.168'
                OR fe_sessions.ses_iplock='[DISABLED]'
                )
                    AND fe_sessions.ses_hashlock=218779088
                     AND fe_users.disable=0 AND fe_users.deleted=0 AND (fe_users.starttime<=1384340298) AND (fe_users.endtime=0 OR fe_users.endtime>1384340298)" 
"Query","DELETE FROM fe_sessions WHERE ses_id = '6415d190c31aa288c97d15d46b540253'
                        AND ses_name = 'fe_typo_user'" 
"Query","SELECT * FROM fe_session_data WHERE hash = '6415d190c31aa288c97d15d46b540253'" 
"Query","SELECT pages.uid,sys_domain.redirectTo,sys_domain.redirectHttpStatusCode,sys_domain.prepend_params FROM pages,sys_domain WHERE pages.uid=sys_domain.pid
                        AND sys_domain.hidden=0
                        AND (sys_domain.domainName='typo3-master.sphinx.lan.pluspol.info' OR sys_domain.domainName='typo3-master.sphinx.lan.pluspol.info/')  AND pages.deleted=0 AND pages.hidden=0 AND pages.starttime<=1384340280 AND (pages.endtime=0 OR pages.endtime>1384340280)  AND NOT pages.t3ver_state>0 AND pages.doktype<200 AND (pages.fe_group='' OR pages.fe_group IS NULL OR pages.fe_group='0' OR FIND_IN_SET('0',pages.fe_group) OR FIND_IN_SET('-1',pages.fe_group)) LIMIT 1" 
"Query","SELECT * FROM pages WHERE pid=0 AND pages.deleted=0 AND pages.hidden=0 AND pages.starttime<=1384340280 AND (pages.endtime=0 OR pages.endtime>1384340280)  AND NOT pages.t3ver_state>0 AND pages.doktype<200 AND (pages.fe_group='' OR pages.fe_group IS NULL OR pages.fe_group='0' OR FIND_IN_SET('0',pages.fe_group) OR FIND_IN_SET('-1',pages.fe_group)) ORDER BY sorting LIMIT 1" 
"Query","SELECT * FROM pages WHERE uid=1 AND pages.deleted=0 AND pages.hidden=0 AND pages.starttime<=1384340280 AND (pages.endtime=0 OR pages.endtime>1384340280)  AND NOT pages.t3ver_state>0 AND pages.doktype<200 AND (pages.fe_group='' OR pages.fe_group IS NULL OR pages.fe_group='0' OR FIND_IN_SET('0',pages.fe_group) OR FIND_IN_SET('-1',pages.fe_group))" 
"Query","SELECT content FROM cf_cache_rootline WHERE identifier = '1__0_0_0' AND cf_cache_rootline.expires >= 1384340298 LIMIT 1" 
"Query","SELECT content FROM cf_cache_pagesection WHERE identifier = '1_222419149' AND cf_cache_pagesection.expires >= 1384340298 LIMIT 1" 
"Query","SELECT content FROM cf_cache_pages WHERE identifier = '7e7cf228cfa0c6c0892caf3f54dccaf7' AND cf_cache_pages.expires >= 1384340298 LIMIT 1" 
"Quit",


Related issues

Related to TYPO3 Core - Feature #42592: FE sessions (cookies) should only be created when needed Closed 2012-11-01
Related to TYPO3 Core - Bug #16302: alt_doc.php does BE session verification twice Closed 2006-06-28
Related to TYPO3 Core - Feature #51731: Store sessions outside DB Closed 2013-09-04
Related to TYPO3 Core - Bug #34964: FE Session record is never removed, even if no session data left Closed 2012-03-17
Related to TYPO3 Core - Bug #56348: Session randomly lost in eID Closed 2014-02-26
Related to TYPO3 Core - Bug #57751: Felogin session not set Closed 2014-04-08

Associated revisions

Revision 40aa8006 (diff)
Added by Alexander Opitz almost 6 years ago

[BUGFIX] Prevent double loading of session data

At the moment we load the session data to verify authentication and
again to verify session existence. This isn't necessary. Also removing
the session deletion if we didn't find session data.

Resolves: #53598
Releases: 6.2
Change-Id: Ibc3c4ebc5c1bbca970374172f714bddcd37b539a
Reviewed-on: https://review.typo3.org/25510
Reviewed-by: Thorsten Kahler
Tested-by: Thorsten Kahler
Reviewed-by: Wouter Wolters
Reviewed-by: Michiel Roos
Tested-by: Michiel Roos
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
Reviewed-by: Ernesto Baschny
Tested-by: Ernesto Baschny

History

#1 Updated by Alexander Opitz about 6 years ago

Hi Thorsten, can you assist on this issue? As you already digged into that code for th "Store sessions outside DB" feature.

#2 Updated by Gerrit Code Review about 6 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25510

#3 Updated by Alexander Opitz about 6 years ago

  • Category set to Code Cleanup
  • Assignee set to Alexander Opitz

#4 Updated by Gerrit Code Review about 6 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25510

#5 Updated by Gerrit Code Review about 6 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25510

#6 Updated by Gerrit Code Review about 6 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25510

#7 Updated by Gerrit Code Review about 6 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25510

#8 Updated by Gerrit Code Review about 6 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25510

#9 Updated by Gerrit Code Review about 6 years ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25510

#10 Updated by Gerrit Code Review about 6 years ago

Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25510

#11 Updated by Gerrit Code Review about 6 years ago

Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/25510

#12 Updated by Markus Klein almost 6 years ago

  • Parent task changed from #52304 to #52949

#13 Updated by Alexander Opitz almost 6 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#14 Updated by Benni Mack about 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF