Topic on Project:Support desk

Media Wiki logs me out after 1-2 minutes

10
Smokinjo67 (talkcontribs)

I am slowly working through issues. One of the other ones is:

either as admin or a regular user, media wiki logs me out with out me asking it to, after 1-2 minutes.

This happens whether I check off he option:

Keep Me Logged in


How might I be able to get it to not log me out?

Smokinjo67 (talkcontribs)

A few more details:


It logs me out less after playing with it.


But, when I edit a file, I get the following error:


Sorry! We could not process your edit due to a loss of session data.

You might have been logged out. Please verify that you're still logged in and try again. If it still does not work, try logging out and logging back in, and check that your browser allows cookies from this sit



If I try pressing save a couple more times, eventually it saves successfully.

Why would I get the error, but it still allows me to save? How can this be avoided?

Thanks

AhmadF.Cheema (talkcontribs)

Does this problem persist even after disabling all the extensions?

Smokinjo67 (talkcontribs)

I disabled all the extensions, and the issue is still there.

It all still works, but it is just a little annoying.

I do not know if this is related, but another issue that I have is in logging out.

It can take 3-4 times of pressing the log out button for it to actually work. The error I get is:


Log out failed due to session error. Please try again.


Both are related to session issues.

Thanks for

AhmadF.Cheema (talkcontribs)
Ciencia Al Poder (talkcontribs)
Smokinjo67 (talkcontribs)

I looked through my LocalSettings.hphp file and there is no $wgSessionCacheType

Do I need to add it here, or somewhere else?

Thanks

Ciencia Al Poder (talkcontribs)

Yes, you'll need to add it manually to override what you hay have set for $wgMainCacheType

Smokinjo67 (talkcontribs)

Hello,


This solution worked for me. Now, I am not logged out and I get no more errors.


Thanks for your help

Harshitsc (talkcontribs)

Hi @Smokinjo67@Ciencia Al Poder

I am working on mediawiki project facing the same issue of frequent logouts,

I have tried adding $wgMainCacheType in my localsettings but this does not works for me in frequent logouts.


I have also tried removing the below code inside of the docker in Setupt.php which is works fine but while login it's showing Cookies may be disabled.


if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {

// If session.auto_start is there, we can't touch session name

if ( $wgPHPSessionHandling !== 'disable' && !wfIniGetBool( 'session.auto_start' ) ){

       session_name($wgSessionName ?: $wgCookiePrefix . '_session');

HeaderCallback::warnIfHeadersSent();

}

// Create the SessionManager singleton and set up our session handler,

// unless we're specifically asked not to.

if ( !defined( 'MW_NO_SESSION_HANDLER' ) ) {

MediaWiki\Session\PHPSessionHandler::install(

MediaWiki\Session\SessionManager::singleton()

);

}

$contLang = MediaWikiServices::getInstance()->getContentLanguage();

// Initialize the session

try {

$session = MediaWiki\Session\SessionManager::getGlobalSession();

} catch ( MediaWiki\Session\SessionOverflowException $ex ) {

// The exception is because the request had multiple possible

// sessions tied for top priority. Report this to the user.

$list = [];

foreach ( $ex->getSessionInfos() as $info ) {

$list[] = $info->getProvider()->describe( $contLang );

}

$list = $contLang->listToText( $list );

throw new HttpError( 400,

Message::newFromKey( 'sessionmanager-tie', $list )->inLanguage( $contLang )

);

}

unset( $contLang );

if ( $session->isPersistent() ) {

$wgInitialSessionId = $session->getSessionId();

}

$session->renew();

if ( MediaWiki\Session\PHPSessionHandler::isEnabled() &&

( $session->isPersistent() || $session->shouldRememberUser() ) &&

session_id() !== $session->getId()

) {

// Start the PHP-session for backwards compatibility

if ( session_id() !== '' ) {

wfDebugLog( 'session', 'PHP session {old_id} was already started, changing to {new_id}', 'all', [

'old_id' => session_id(),

'new_id' => $session->getId(),

] );

session_write_close();

}

session_id( $session->getId() );

session_start();

}

unset( $session );

} else {

// Even if we didn't set up a global Session, still install our session

// handler unless specifically requested not to.

if ( !defined( 'MW_NO_SESSION_HANDLER' ) ) {

MediaWiki\Session\PHPSessionHandler::install(

MediaWiki\Session\SessionManager::singleton()

);

}

}


Can anyone assist here.

Thanks.

Reply to "Media Wiki logs me out after 1-2 minutes"