Issue Details (XML | Word | Printable)

Key: MDL-14992
Type: Sub-task Sub-task
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Petr Skoda
Reporter: Eloy Lafuente (stronk7)
Votes: 1
Watchers: 2
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle
MDL-14679

M2: adodb sessions switched to moodle sessions

Created: 26/May/08 08:54 AM   Updated: 12/Mar/09 12:41 AM
Return to search
Component/s: Database SQL/XMLDB
Affects Version/s: 2.0
Fix Version/s: 2.0

Issue Links:
Relates
 

Participants: Eloy Lafuente (stronk7), Jamie Pratt, Petr Skoda, Sam Marshall and Wen Hao Chuang
Security Level: None
Resolved date: 20/Jan/09
Affected Branches: MOODLE_20_STABLE
Fixed Branches: MOODLE_20_STABLE


 Description  « Hide
as commented in chat... we need something related to sessions in new stuff.

Analyse the possibility to use $DB (will save one connection compared with current approach).

And also the possibility of specify different $DB.

just to avoid forgetting about it.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Petr Skoda committed 69 files to 'Moodle CVS' - 20/Jun/08 06:27 AM
MDL-14992 first step towards new database sessions - refactoring of current session code
ADD lib/sessionlib.php   Rev. 1.1    (+0 -0 lines)
MODIFY theme/orangewhite/styles.php   Rev. 1.9    (+2 -2 lines)
MODIFY mnet/environment.php   Rev. 1.18    (+3 -3 lines)
MODIFY lib/javascript-mod.php   Rev. 1.2    (+2 -2 lines)
MODIFY mod/chat/gui_header_js/jsupdate.php   Rev. 1.39    (+2 -2 lines)
MODIFY theme/chameleon/styles.php   Rev. 1.5    (+2 -2 lines)
MODIFY theme/orangewhitepda/Attic/docstyles.php   Rev. 1.4    (+2 -2 lines)
MODIFY auth/db/auth_db_sync_users.php   Rev. 1.6    (+1 -1 lines)
MODIFY theme/oceanblue/Attic/docstyles.php   Rev. 1.5    (+2 -2 lines)
DEL lib/Attic/cookieless.php   Rev. 1.5    (+0 -0 lines)
MODIFY theme/oceanblue/styles.php   Rev. 1.34    (+2 -2 lines)
MODIFY filter/algebra/pix.php   Rev. 1.23    (+2 -2 lines)
MODIFY blocks/login/block_login.php   Rev. 1.27    (+2 -2 lines)
MODIFY user/pix.php   Rev. 1.18    (+2 -2 lines)
MODIFY theme/standard/Attic/docstyles.php   Rev. 1.4    (+2 -2 lines)
MODIFY theme/cornflower/Attic/docstyles.php   Rev. 1.8    (+2 -2 lines)
MODIFY mod/chat/gui_header_js/users.php   Rev. 1.20    (+2 -2 lines)
MODIFY theme/wood/styles.php   Rev. 1.6    (+2 -2 lines)
MODIFY filter/algebra/algebradebug.php   Rev. 1.23    (+2 -2 lines)
MODIFY login/index.php   Rev. 1.138    (+5 -5 lines)
MODIFY admin/index.php   Rev. 1.323    (+5 -5 lines)
MODIFY admin/mnet/index.php   Rev. 1.20    (+4 -4 lines)
MODIFY grade/export/xls/dump.php   Rev. 1.9    (+2 -2 lines)
MODIFY login/confirm.php   Rev. 1.33    (+2 -2 lines)
MODIFY auth/ldap/auth.php   Rev. 1.61    (+1 -1 lines)
MODIFY admin/cron.php   Rev. 1.144    (+2 -3 lines)
MODIFY mod/data/css.php   Rev. 1.4    (+3 -3 lines)
MODIFY pix/smartpix.php   Rev. 1.2    (+1 -1 lines)
MODIFY lib/moodlelib.php   Rev. 1.1061    (+8 -92 lines)
MODIFY mod/chat/gui_header_js/chatinput.php   Rev. 1.25    (+2 -2 lines)
MODIFY lib/filelib.php   Rev. 1.70    (+5 -5 lines)
MODIFY auth/shibboleth/index.php   Rev. 1.19    (+2 -2 lines)
MODIFY theme/standardred/styles.php   Rev. 1.44    (+2 -2 lines)
MODIFY theme/formal_white/Attic/docstyles.php   Rev. 1.4    (+2 -2 lines)
MODIFY filter/tex/texed.php   Rev. 1.9    (+2 -2 lines)
MODIFY theme/metal/styles.php   Rev. 1.13    (+2 -2 lines)
MODIFY grade/import/xml/fetch.php   Rev. 1.8    (+2 -2 lines)
MODIFY mod/chat/gui_header_js/jsupdated.php   Rev. 1.12    (+2 -2 lines)
MODIFY theme/orangewhite/Attic/docstyles.php   Rev. 1.4    (+2 -2 lines)
MODIFY lib/adminlib.php   Rev. 1.220    (+15 -13 lines)
MODIFY theme/standardgreen/styles.php   Rev. 1.44    (+2 -2 lines)
MODIFY grade/export/txt/dump.php   Rev. 1.9    (+2 -2 lines)
MODIFY index.php   Rev. 1.215    (+3 -3 lines)
MODIFY filter/tex/pix.php   Rev. 1.33    (+2 -2 lines)
MODIFY mod/quiz/accessrules.php   Rev. 1.6    (+3 -2 lines)
MODIFY lib/setup.php   Rev. 1.239    (+26 -138 lines)
MODIFY theme/standardwhite/styles.php   Rev. 1.40    (+2 -2 lines)
MODIFY auth/ldap/auth_ldap_sync_users.php   Rev. 1.5    (+1 -1 lines)
MODIFY lib/session-test.php   Rev. 1.6    (+3 -10 lines)
MODIFY theme/standardlogo/styles.php   Rev. 1.45    (+2 -2 lines)
MODIFY grade/export/xml/dump.php   Rev. 1.9    (+2 -2 lines)
MODIFY rss/file.php   Rev. 1.22    (+3 -3 lines)
MODIFY theme/standard/styles.php   Rev. 1.66    (+2 -2 lines)
MODIFY theme/cornflower/styles.php   Rev. 1.16    (+2 -2 lines)
MODIFY theme/orangewhitepda/styles.php   Rev. 1.6    (+2 -2 lines)
MODIFY mod/chat/gui_sockets/chatinput.php   Rev. 1.17    (+2 -2 lines)
MODIFY grade/export/ods/dump.php   Rev. 1.9    (+2 -2 lines)
MODIFY theme/standardblue/styles.php   Rev. 1.44    (+2 -2 lines)
MODIFY admin/Attic/cliupgrade.php   Rev. 1.21    (+1 -1 lines)
MODIFY theme/formal_white/styles.php   Rev. 1.21    (+2 -2 lines)
MODIFY user/Attic/pixgroup.php   Rev. 1.9    (+2 -2 lines)
MODIFY lib/weblib.php   Rev. 1.1091    (+6 -7 lines)
MODIFY auth/ldap/ntlmsso_magic.php   Rev. 1.3    (+1 -1 lines)
MODIFY mod/chat/chatd.php   Rev. 1.36    (+2 -2 lines)
MODIFY theme/custom_corners/styles.php   Rev. 1.3    (+2 -2 lines)
MODIFY auth/cas/cas_ldap_sync_users.php   Rev. 1.6    (+1 -1 lines)
MODIFY auth/shibboleth/login.php   Rev. 1.4    (+3 -3 lines)
MODIFY filter/tex/texdebug.php   Rev. 1.26    (+2 -2 lines)
MODIFY mod/data/js.php   Rev. 1.4    (+2 -2 lines)
Petr Skoda added a comment - 20/Jun/08 06:31 AM
adodb sessions are not working at all in 1.9.x and before, because it lacks session locking code (== multiple open windows or linked files override each others changes)
we need something better in 2.0

moodler committed 1 file to 'Moodle CVS' - 20/Jun/08 03:33 PM
MDL-14992 $SESSION is a global
MODIFY blocks/login/block_login.php   Rev. 1.28    (+2 -2 lines)
Jamie Pratt added a comment - 22/Jun/08 06:43 PM
Getting the following notices and warnings from tablelib code. They just started a few days ago after an update of HEAD :

Notice: Indirect modification of overloaded property moodle_session::$flextable has no effect in C:\Users\Pratt\workspace\moodle-HEAD\lib\tablelib.php on line 360

Notice: Indirect modification of overloaded property moodle_session::$flextable has no effect in C:\Users\Pratt\workspace\moodle-HEAD\lib\tablelib.php on line 361

Notice: Indirect modification of overloaded property moodle_session::$flextable has no effect in C:\Users\Pratt\workspace\moodle-HEAD\lib\tablelib.php on line 362

Notice: Indirect modification of overloaded property moodle_session::$flextable has no effect in C:\Users\Pratt\workspace\moodle-HEAD\lib\tablelib.php on line 363

Notice: Indirect modification of overloaded property moodle_session::$flextable has no effect in C:\Users\Pratt\workspace\moodle-HEAD\lib\tablelib.php on line 364

Notice: Indirect modification of overloaded property moodle_session::$flextable has no effect in C:\Users\Pratt\workspace\moodle-HEAD\lib\tablelib.php on line 365

Notice: Indirect modification of overloaded property moodle_session::$flextable has no effect in C:\Users\Pratt\workspace\moodle-HEAD\lib\tablelib.php on line 368

Warning: Attempt to assign property of non-object in C:\Users\Pratt\workspace\moodle-HEAD\lib\tablelib.php on line 417


Petr Skoda added a comment - 22/Jun/08 07:54 PM
this is caused by http://bugs.php.net/bug.php?id=39449, grrrrrrrrrr

working on a hack


Petr Skoda committed 1 file to 'Moodle CVS' - 22/Jun/08 07:56 PM
Petr Skoda added a comment - 22/Jun/08 07:56 PM
I hope this problem is now fixed in cvs

Wen Hao Chuang added a comment - 09/Sep/08 07:39 AM
+1 for this, here at SFSU we running a really big site on a VM system (VMWare), and we are seeing some session-related issues that lead to slow performance....

Petr Skoda committed 3 files to 'Moodle CVS' - 31/Dec/08 09:24 PM
MDL-14992 new database based session table - not used yet
MODIFY lib/db/install.xml   Rev. 1.181    (+17 -13 lines)
MODIFY version.php   Rev. 1.938    (+1 -1 lines)
MODIFY lib/db/upgrade.php   Rev. 1.256    (+46 -1 lines)
Petr Skoda made changes - 31/Dec/08 09:34 PM
Field Original Value New Value
Link This issue has been marked as being related by MDL-17754 [ MDL-17754 ]
Petr Skoda committed 29 files to 'Moodle CVS' - 15/Jan/09 02:08 AM
MDL-14992 towards new moodle db sessions
DEL lib/adodb/session/old/Attic/adodb-session.php   Rev. 1.8    (+0 -0 lines)
DEL lib/adodb/session/Attic/adodb-encrypt-sha1.php   Rev. 1.3    (+0 -0 lines)
DEL lib/adodb/session/Attic/adodb-cryptsession2.php   Rev. 1.9    (+0 -0 lines)
MODIFY lib/db/upgrade.php   Rev. 1.267    (+51 -56 lines)
DEL lib/adodb/session/Attic/adodb-sessions.oracle.sql   Rev. 1.2    (+0 -0 lines)
DEL lib/adodb/session/Attic/adodb-encrypt-mcrypt.php   Rev. 1.14    (+0 -0 lines)
DEL lib/adodb/session/Attic/adodb-encrypt-secret.php   Rev. 1.14    (+0 -0 lines)
MODIFY version.php   Rev. 1.964    (+1 -1 lines)
DEL lib/adodb/session/Attic/adodb-session-clob.php   Rev. 1.14    (+0 -0 lines)
DEL lib/adodb/session/Attic/adodb-session2.php   Rev. 1.10    (+0 -0 lines)
DEL lib/adodb/session/Attic/adodb-sessions.mysql.sql   Rev. 1.2    (+0 -0 lines)
DEL lib/adodb/session/Attic/adodb-sess.txt   Rev. 1.2    (+0 -0 lines)
DEL lib/adodb/session/Attic/adodb-compress-gzip.php   Rev. 1.14    (+0 -0 lines)
DEL lib/adodb/session/Attic/adodb-session.php   Rev. 1.15    (+0 -0 lines)
DEL lib/adodb/session/old/Attic/crypt.inc.php   Rev. 1.2    (+0 -0 lines)
DEL lib/adodb/session/Attic/crypt.inc.php   Rev. 1.3    (+0 -0 lines)
DEL lib/adodb/session/Attic/session_schema2.xml   Rev. 1.3    (+0 -0 lines)
MODIFY lib/simpletestlib.php   Rev. 1.25    (+3 -3 lines)
DEL lib/adodb/session/old/Attic/adodb-session-clob.php   Rev. 1.8    (+0 -0 lines)
MODIFY lib/db/install.xml   Rev. 1.190    (+8 -7 lines)
DEL lib/adodb/session/Attic/adodb-session-clob2.php   Rev. 1.9    (+0 -0 lines)
DEL lib/adodb/session/Attic/adodb-encrypt-md5.php   Rev. 1.15    (+0 -0 lines)
MODIFY lib/adodb/readme_moodle.txt   Rev. 1.21    (+3 -2 lines)
DEL lib/adodb/session/old/Attic/adodb-cryptsession.php   Rev. 1.9    (+0 -0 lines)
DEL lib/adodb/session/Attic/adodb-cryptsession.php   Rev. 1.14    (+0 -0 lines)
DEL lib/adodb/session/Attic/session_schema.xml   Rev. 1.2    (+0 -0 lines)
DEL lib/adodb/session/Attic/adodb-sessions.oracle.clob.sql   Rev. 1.2    (+0 -0 lines)
MODIFY admin/multilangupgrade.php   Rev. 1.11    (+2 -2 lines)
DEL lib/adodb/session/Attic/adodb-compress-bzip2.php   Rev. 1.14    (+0 -0 lines)
Petr Skoda committed 2 files to 'Moodle CVS' - 15/Jan/09 03:32 AM
MDL-14992 towards new moodle db sessions
MODIFY lib/sessionlib.php   Rev. 1.17    (+38 -23 lines)
MODIFY lang/en_utf8/error.php   Rev. 1.158    (+2 -1 lines)
Petr Skoda committed 3 files to 'Moodle CVS' - 17/Jan/09 02:27 AM
MDL-14992 towards better db sessions
MODIFY lib/sessionlib.php   Rev. 1.18    (+188 -26 lines)
MODIFY lib/dml/moodle_database.php   Rev. 1.80    (+15 -1 lines)
MODIFY lib/filelib.php   Rev. 1.122    (+7 -7 lines)
Petr Skoda committed 6 files to 'Moodle CVS' - 17/Jan/09 05:43 AM
MDL-14992 towards better db sessions
MODIFY version.php   Rev. 1.967    (+1 -1 lines)
MODIFY login/index.php   Rev. 1.144    (+2 -2 lines)
MODIFY lib/sessionlib.php   Rev. 1.19    (+4 -3 lines)
MODIFY index.php   Rev. 1.220    (+2 -2 lines)
MODIFY lib/db/upgrade.php   Rev. 1.268    (+4 -4 lines)
MODIFY lib/db/install.xml   Rev. 1.191    (+1 -1 lines)
Petr Skoda committed 1 file to 'Moodle CVS' - 17/Jan/09 06:37 AM
MDL-14992 towards better db sessions
MODIFY lib/sessionlib.php   Rev. 1.20    (+17 -3 lines)
Petr Skoda committed 1 file to 'Moodle CVS' - 17/Jan/09 07:07 AM
MDL-14992 towards better db sessions
MODIFY lang/en_utf8/error.php   Rev. 1.159    (+3 -1 lines)
Petr Skoda committed 3 files to 'Moodle CVS' - 17/Jan/09 08:02 AM
MDL-14992 towards better db sessions - session locking for mysql
MODIFY lib/dml/moodle_database.php   Rev. 1.81    (+12 -1 lines)
MODIFY lib/sessionlib.php   Rev. 1.21    (+11 -3 lines)
MODIFY lib/dml/mysqli_native_moodle_database.php   Rev. 1.26    (+47 -2 lines)
Petr Skoda committed 3 files to 'Moodle CVS' - 17/Jan/09 09:12 PM
MDL-14992 pg sessions advisory locks accept only integers :-( trying to find a workaround
MODIFY lib/dml/moodle_database.php   Rev. 1.82    (+3 -3 lines)
MODIFY lib/dml/mysqli_native_moodle_database.php   Rev. 1.27    (+14 -17 lines)
MODIFY lib/sessionlib.php   Rev. 1.22    (+43 -24 lines)
Petr Skoda committed 1 file to 'Moodle CVS' - 17/Jan/09 09:15 PM
MDL-14992 towards better db sessions
MODIFY lib/sessionlib.php   Rev. 1.23    (+2 -2 lines)
Petr Skoda committed 4 files to 'Moodle CVS' - 17/Jan/09 11:31 PM
MDL-14992 pg session locking (8.2 and later only), refactoring and db session not default yet in new installs
MODIFY lib/dml/mysqli_native_moodle_database.php   Rev. 1.28    (+9 -12 lines)
MODIFY lib/sessionlib.php   Rev. 1.24    (+4 -5 lines)
MODIFY lib/dml/moodle_database.php   Rev. 1.83    (+8 -14 lines)
MODIFY lib/dml/pgsql_native_moodle_database.php   Rev. 1.28    (+41 -1 lines)
Petr Skoda committed 1 file to 'Moodle CVS' - 17/Jan/09 11:35 PM
MDL-14992sid rewriting improvement
MODIFY lib/sessionlib.php   Rev. 1.25    (+5 -2 lines)
Petr Skoda committed 1 file to 'Moodle CVS' - 17/Jan/09 11:48 PM
MDL-14992 towards better db sessions
MODIFY lib/sessionlib.php   Rev. 1.26    (+6 -6 lines)
Petr Skoda committed 15 files to 'Moodle CVS' - 18/Jan/09 12:25 AM
MDL-14992 refactored use of session_write_close()
MODIFY mod/chat/gui_ajax/Attic/post.php   Rev. 1.4    (+2 -2 lines)
MODIFY lib/filelib.php   Rev. 1.123    (+4 -4 lines)
MODIFY lib/dml/moodle_database.php   Rev. 1.84    (+2 -2 lines)
MODIFY admin/cron.php   Rev. 1.158    (+2 -2 lines)
MODIFY course/report/log/index.php   Rev. 1.25    (+2 -2 lines)
MODIFY mod/chat/gui_header_js/insert.php   Rev. 1.17    (+2 -2 lines)
MODIFY lib/moodlelib.php   Rev. 1.1156    (+2 -2 lines)
MODIFY draftfile.php   Rev. 1.9    (+2 -2 lines)
MODIFY userfile.php   Rev. 1.9    (+2 -2 lines)
MODIFY course/report/log/live.php   Rev. 1.14    (+2 -2 lines)
MODIFY question/file.php   Rev. 1.10    (+1 -1 lines)
MODIFY lib/sessionlib.php   Rev. 1.27    (+62 -32 lines)
MODIFY pluginfile.php   Rev. 1.7    (+5 -5 lines)
MODIFY file.php   Rev. 1.57    (+2 -2 lines)
MODIFY admin/dbtransfer/lib.php   Rev. 1.4    (+3 -3 lines)
Petr Skoda committed 2 files to 'Moodle CVS' - 18/Jan/09 02:44 AM
MDL-14992 adding links to oracle locking info - thanks Eloy
MODIFY lib/dml/oci_native_moodle_database.php   Rev. 1.5    (+4 -1 lines)
MODIFY lib/dml/oci_native_moodle_database.php   Rev. 1.6    (+2 -2 lines)
Petr Skoda added a comment - 20/Jan/09 01:54 AM
db sessions are now working fine for mysql and pg, not compatible with mssql and oracle

Petr Skoda made changes - 20/Jan/09 01:54 AM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Mitsuhiro Yoshida committed 5 files to 'Lang CVS' - 20/Jan/09 06:08 AM
MDL-14992 Translated a new string for error messages.
MDL-14319 Brushed up a translated help file for lessong - small XHTML fixes,
MDL-12886 Translated new strings for web services.
MDL-17914 Translated a new string for conditional activities.
MODIFY ja_utf8/admin.php   Rev. 1.334    (+3 -1 lines)
MODIFY ja_utf8/help/lesson/questiontypes.html   Rev. 1.22    (+4 -5 lines)
MODIFY ja_utf8/error.php   Rev. 1.117    (+2 -1 lines)
MODIFY ja_utf8/condition.php   Rev. 1.3    (+2 -1 lines)
MODIFY ja_utf8/README   Rev. 1.920    (+1 -1 lines)
Mitsuhiro Yoshida committed 5 files to 'Lang CVS' - 22/Jan/09 08:18 AM
MDL-17889 Translated a new string for tag.
MDL-14992 MDL-17302 MDL-17942 Translated new strings for error messages.
MDL-17364 Translated a new string for forum ajax rating.
MDL-16651 Translated a new string for scorm.
MODIFY ja_utf8/README   Rev. 1.922    (+1 -1 lines)
MODIFY ja_utf8/forum.php   Rev. 1.83    (+3 -1 lines)
MODIFY ja_utf8/scorm.php   Rev. 1.44    (+2 -1 lines)
MODIFY ja_utf8/error.php   Rev. 1.118    (+4 -0 lines)
MODIFY ja_utf8/tag.php   Rev. 1.19    (+2 -1 lines)
martignoni committed 1 file to 'Lang CVS' - 23/Jan/09 06:17 AM
MDL-14992 New string
MODIFY fr_utf8/error.php   Rev. 1.160    (+2 -1 lines)
martignoni committed 1 file to 'Lang CVS' - 24/Jan/09 04:39 AM
MDL-14992 Strings added
MODIFY fr_utf8/error.php   Rev. 1.161    (+3 -1 lines)
Sam Marshall added a comment - 11/Mar/09 11:26 PM
As part of the change under this bug number, the following code was added:

} else if ((!isset($CFG->dbsessions) or $CFG->dbsessions) and $DB->session_lock_supported()) { // default recommended session type $session = new database_session(); } else {
// legacy limited file based storage - some features and auth plugins will not work, sorry
$session = new legacy_file_session();

For performance we were thinking about moving to local disk-based sessions and it would definitely be nice to have this as an option! Questions:

1) why do file sessions not work? do they really not work? is this documented somewhere as to what doesn't work? If so maybe the comment could include a link to the more detailed information. There is no info on legacy_file_session class either...

2) this is at the least unfortunate, when file sessions are a good way to take load off overworked db server...

(ok #2 that wasn't a question)


Petr Skoda added a comment - 12/Mar/09 12:11 AM
1/ file based sessions are problematic because you are not notified when the sessions expires - the file just gets deleted at some random time
2/ it is not possible to "query" folder with file sessions
3/ there are other way to off load db servers, for example shared memory

Sam Marshall added a comment - 12/Mar/09 12:41 AM
thanks.

#1 why/in which places does moodle need to know when the session expires, i.e. what does this break?

#2 why/in which places is the 'query' feature needed? This sounds like a dealbreaker for local file sessions as by definition it is not possible if they are stored locally and you have more than one server, however I don't understand why it would ever be necessary.

#3 I thought sessions were written on every request? if this is the case then they will still cause very high DB load even if the reads are cached.


Eloy Lafuente (stronk7) committed 5 files to 'Moodle CVS' - 26/May/09 10:46 PM
MDL-14992 sessions - proper destructor method and fixed dispose() behaviour.
MODIFY lib/dml/oci_native_moodle_database.php   Rev. 1.8    (+2 -2 lines)
MODIFY lib/dml/Attic/adodb_moodle_database.php   Rev. 1.31    (+2 -2 lines)
MODIFY lib/dml/pgsql_native_moodle_database.php   Rev. 1.32    (+2 -2 lines)
MODIFY lib/dml/mysqli_native_moodle_database.php   Rev. 1.35    (+2 -2 lines)
MODIFY lib/dml/moodle_database.php   Rev. 1.88    (+2 -2 lines)