-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Failed to start application: Failed to start application #26861
Comments
Better yet. Don't delete the users table |
I don't delete the users table; I delete individual rows upon certain events - there is no way around that in this case. Also, for what it's worth, I am instantiating Joomla and deleting the user row via the delete() method:-
|
Related issue #26539. Session is not terminated when using PHP Session Handler. |
as you are in 3.x you can delete all sessions for the user account as well |
Truthfully, I don't think you can do anything "user friendly" with this condition. Essentially the problem boils down to unserializing the session data runs into an error with some of the data inside of it. If you tried to do some kind of basic error handling for the condition you'd end up in a really awkward state:
I think this is a case of "it sucks but this is the least sucky of the available options" |
Appears I can't unless I use the database as the session handler. The user delete() method only clears out the database row for the users session as per #26539 |
That's kind of where I was leading. I've whittled this down to being caused by a call to |
So... I was about to write that this is a wont-fix and tough luck, you have to take care of this yourself. Then I looked into this further and sigh we have to fix this. Simply said, the code to clear the session is doing this badly. Joomla writes the user ID, username and the session ID to the database, regardless of the used session storage and it does so both in J3 and J4. We are deleting the entries in the sessions table in the "User - Joomla" plugin in the onAfterDeleteUser event with a simple query and that actually sucks. We actually have to get all session IDs assigned to a user from the session table, then load the sessions for all those IDs and call a destroy() on them, then delete all those entries from the table. I actually think with the current setup of our session system, we have to add something like a "delete storage based on a given ID" method to implement this. This would have to be fixed in J3 and J4. And now that I've shown how to fix that, I will leave the glory of actually doing the code to someone else. |
Please change the label to J4 issue based on the comment by @Hackwar above |
Look like the issue was sorted elsewhere (there were some PRs dealing with session handling sessions in the past). I just tried again with latest Joomla 4.2 and it is working well. After user being deleted, refresh shows him as guest/not logged in user. As this issue is not valid anymore, I'm closing this. Feel free to re-open if you can still re-procedure the issue with latest Joomla 4. |
Steps to reproduce the issue
Delete user row from #_users table.
Expected result
User should be presented with something more user friendly, a la "User account removed, please reg-register".
Actual result
User session data is persisted in his/her browser, so on next page load, the user is presented with a blank page with the error:-
Error: Failed to start application: Failed to start application
System information (as much as possible)
Joomla 3.9.8.
Additional comments
Here's the stack which is causing this to be thrown:-
"#0 /var/www/html/libraries/src/Log/Logger/MessagequeueLogger.php(48): Joomla\CMS\Factory::getApplication()
#1 /var/www/html/libraries/src/Log/Log.php(320): Joomla\CMS\Log\Logger\MessagequeueLogger->addEntry(Object(Joomla\CMS\Log\LogEntry))
#2 /var/www/html/libraries/src/Log/Log.php(166): Joomla\CMS\Log\Log->addLogEntry(Object(Joomla\CMS\Log\LogEntry))
#3 /var/www/html/libraries/src/User/User.php(888): Joomla\CMS\Log\Log::add('JLIB_USER_ERROR...', 16, 'jerror')
#4 /var/www/html/libraries/src/User/User.php(946): Joomla\CMS\User\User->load('633')
#5 [internal function]: Joomla\CMS\User\User->__wakeup()
#6 /var/www/html/libraries/src/Session/Session.php(670): unserialize('O:24:"Joomla\Re...')
#7 /var/www/html/libraries/src/Session/Session.php(620): Joomla\CMS\Session\Session->_start()
#8 /var/www/html/libraries/src/Session/Session.php(498): Joomla\CMS\Session\Session->start()
#9 /var/www/html/libraries/src/Factory.php(257): Joomla\CMS\Session\Session->get('user')
#10 /var/www/html/libraries/src/Application/CMSApplication.php(153): Joomla\CMS\Factory::getUser()
#11 /var/www/html/libraries/src/Application/CMSApplication.php(760): Joomla\CMS\Application\CMSApplication->checkSession()
#12 /var/www/html/libraries/src/Application/CMSApplication.php(135): Joomla\CMS\Application\CMSApplication->loadSession()
#13 /var/www/html/libraries/src/Application/SiteApplication.php(66): Joomla\CMS\Application\CMSApplication->__construct(NULL, NULL, NULL)
#14 /var/www/html/libraries/src/Application/CMSApplication.php(344): Joomla\CMS\Application\SiteApplication->__construct()
#15 /var/www/html/libraries/src/Factory.php(143): Joomla\CMS\Application\CMSApplication::getInstance('site')
#16 /var/www/html/index.php(51): Joomla\CMS\Factory::getApplication('site')
#17 {main}"
"#0 /var/www/html/libraries/src/Exception/ExceptionHandler.php(62): Joomla\CMS\Factory::getApplication()
#1 [internal function]: Joomla\CMS\Exception\ExceptionHandler::render(Object(Exception))
#2 {main}"
Error: Failed to start application: Failed to start application
The issue I can see here is the "user" still has a valid php session in their browser. Decoding the session file on the server, I can see that the user in this instance was user ID "633", which I had deleted from the #_users table via an external script.
Looking into various methods on how I can catch this before the error is thrown, probably ideally in my situation by just destroying the users session, but seems my options may be limited without the new onBeforeExecute event in v4? Looks like I'm in a similar situation as reported in #10903
The text was updated successfully, but these errors were encountered: