Since the last update, I get very often the following error:
Error initialising the session.
With the following Call-Stack:
Call stack # Function Location
1 JApplicationCms->execute() /var/www/joomla/index.php:52
2 JApplicationSite->doExecute() /var/www/joomla/libraries/cms/application/cms.php:252
3 JApplicationSite->initialiseApp() /var/www/joomla/libraries/cms/application/site.php:209
4 JApplicationCms->initialiseApp() /var/www/joomla/libraries/cms/application/site.php:663
5 JApplicationBase->triggerEvent() /var/www/joomla/libraries/cms/application/cms.php:654
6 JEventDispatcher->trigger() /var/www/joomla/libraries/joomla/application/base.php:106
7 JEvent->update() /var/www/joomla/libraries/joomla/event/dispatcher.php:160
8 call_user_func_array() /var/www/joomla/libraries/joomla/event/event.php:69
9 PlgSystemRemember->onAfterInitialise()
10 JApplicationSite->login() /var/www/joomla/plugins/system/remember/remember.php:58
11 JApplicationCms->login() /var/www/joomla/libraries/cms/application/site.php:694
12 JApplicationBase->triggerEvent() /var/www/joomla/libraries/cms/application/cms.php:849
13 JEventDispatcher->trigger() /var/www/joomla/libraries/joomla/application/base.php:106
14 JEvent->update() /var/www/joomla/libraries/joomla/event/dispatcher.php:160
15 call_user_func_array() /var/www/joomla/libraries/joomla/event/event.php:69
16 PlgUserJoomla->onUserLogin()
17 JApplicationCms->checkSession() /var/www/joomla/plugins/user/joomla/joomla.php:216
I have a highly frequent used site, and since I log every error, this error occures very often. 2000-4000 times a day, sometimes even I am affected. It happens very unregular. After I refresh the site, it works again.
Visit site after the session is expired.
You are logged in, page works fine.
You get an error-message.
Latest Joomla Version. This error started after the last update.
PHP erstellt für Linux CZ17 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt20-1+deb8u1 (2015-12-14) x86_64
Datenbankversion 5.5.46-0+deb8u1-log
Datenbankzeichensatz utf8_general_ci
PHP-Version 5.6.14-0+deb8u1
Webserver nginx/1.6.2
PHP-Interface für den Webserver fpm-fcgi
Joomla!-Version Joomla! 3.4.8 Stable [ Ember ] 24-December-2015 19:30 GMT
Joomla!-Plattform-Version Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
Browsererkennung Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0
Thanks for your help!
I don't know why this is happening, but it seems empty session-ids are causing this issue:
Error initialising the session. Duplicate entry '' for key 'PRIMARY' SQL=INSERT $
(session_id
, client_id
, guest
, time
, userid
, username
) VALUES
('', 0, 1, '0', 0, '')
I will look, how to solve this issue.
Adding the following code snippet:
if($session->getId() == ''){
$session->restart();
}
right after
$session = JFactory::getSession();
in libraries/cms/application/cms.php solved this issue. Although I have not changed any core code, I could not found any further information about this issue on google or the issue tracker. There is a possibility for some individual code in my components/plugins which causes this issue.
It could a Joomla bug, if the session is not in "active" state ?
Temporarily please revert your change, and try at the same place as descibe above:
jimport('joomla.log.log');
JLog::addLogger(array('text_file' => 'session_errors.php'));
JLog::add(
JText::_('JERROR_SESSION_STARTUP').
' Session State: '.$session->getState().
' Sql Error: '.$db->getErrorMsg()
);
then after error occurs search in the file for "Session State"
Hello,
here's the log:
Error initialising the session.
Session State: destroyed
Sql Error: Duplicate entry '' for key 'PRIMARY' SQL=INSERT INTOjoomla_session
(session_id
,client_id
,guest
,time
,userid
,username
) VALUES
('', 0, 1, '0', 0, '')
Hope this helps.
JFactory::getSession();
will call JSession::createSession()
if ($session->getState() == 'expired')
{
$session->restart();
}
it does not restart the session if is "destroyed"
maybe (or maybe NOT) it needs:
$state = $session->getState();
if ($state== 'expired' || $state=='destroyed') {
$session->restart();
}
but i don't know why session is destroyed in the first place
there is a PHP bug effecting PHP 7 , PHP 5.5. and PHP 5.4 ?
that causes
session_regenerate_id(true);
to randomly generates a warning and lose session data
i mention it because you are high traffic and you have it randomly, (you can not find some specific actions to reproduce it, instead you must wait for it to happen randomly ?)
i don't have enough knowledge with JSession to say much more
Unfortunately, I could not reproduce this issue. Nevertheless it also happened to me 1-2 times. I can not predict or say it's random: sometimes ~1000 times in less than 5 minutes and then only ~1000 in several hours.
I'm going to further investigate this issue.
I don't know if this is related but the last several times I've let a
session time out in my clean 3.4.8 install when the login prompt comes
up and I log in it tells me the session expired and forces me to log in
again.
Bear
On 1/11/2016 04:57, enesbil wrote:
Unfortunately, I could not reproduce this issue. Nevertheless it also
happened to me 1-2 times. It happens really random, sometimes ~1000
times in less than 5 minutes and then only ~1000 in several hours.I'm going to further investigate this issue.
—
Reply to this email directly or view it on GitHub
#8871 (comment).
I am experiencing problem with session instantiation with a third party cakephp application that loads the joomla mainframe to allow SSO using joomla logged in user data (as described here). I got a blank page in the cakephp just saying "Application Instantiation Error: Error initialising the session". No errors were logged
It seems that the solution proposed in the comment by ggppdk solved the issue, but the core joomla file has to be edited, which is obviouslly not fine at all.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-04-08 14:06:52 |
Closed_By | ⇒ | brianteeman |
I am closing this issue at this time. The session code has had a lot of changes since this issue was reported so it might have been resolved by those changes. If you are still having an issue with the current release please create a new issue. Thanks
when update to 3.6.0 i have this problem. and sometimes user get information with no login... i get three different errors on same way:
1062 Error initialising the session.
or
The most recent request was denied because it contained an invalid security token. Please refresh the page and try again.
or
Error displaying the error page: Application Instantiation Error: Error initialising the session.
Hello,
I am using joomla 3.6.0 version and i am still getting the same error, when i refresh the page it start working fine..
Can you please help me where i need to update to fix this error ?
Thanks
I'm having the same problem as Kunal0143 above. I don't know why but my dev doesn't reproduce the error.
No one will see a comment on a closed issue.
SQL Insertion query into the session table fails
Temporarily, until you get the error to occur again, edit file:
libraries/cms/application/cms.php
about line 212, find
exactly above it (and inside the catch block) add line:
then wait unitil error occurs and this file is created:
.../joomla_folder/logs/session_errors.php
hopefully the SQL error is there ?