Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: -christian on January 30, 2019, 03:17:40 AM

Title: 512: loadMemberContext()
Post by: -christian on January 30, 2019, 03:17:40 AM
Hi everybody,
I just got tons of error messages in my log. All of them complaining about

https://www.pearl-jam.de/index.php?&threadid=2466%3bstart=45
512: loadMemberContext(): member id 84 not previously loaded by loadMemberData()
Datei: /[path]/Sources/Load.php
Zeile: 1138

Installed mods:
Any help appreciated.
Title: Re: 512: loadMemberContext()
Post by: Aleksi "Lex" Kilpinen on February 08, 2019, 04:12:03 PM
Did this just start suddenly, or did you do something just before?
Could you post the mentioned line, plus a few lines before and after, from your Load.php?
Title: Re: 512: loadMemberContext()
Post by: -christian on March 01, 2019, 02:38:26 AM
Quote from: Aleksi "Lex" Kilpinen on February 08, 2019, 04:12:03 PM
Did this just start suddenly, or did you do something just before?
Could you post the mentioned line, plus a few lines before and after, from your Load.php?
We performed an update coming from 1.x SMF. After that, the errors started popping up in our logs.

// Loads the user's basic values... meant for template/theme usage.
function loadMemberContext($user, $display_custom_fields = false)
{
global $memberContext, $user_profile, $txt, $scripturl, $user_info;
global $context, $modSettings, $board_info, $settings;
global $smcFunc;
static $dataLoaded = array();

// If this person's data is already loaded, skip it.
if (isset($dataLoaded[$user]))
return true;

// We can't load guests or members not loaded by loadMemberData()!
if ($user == 0)
return false;
if (!isset($user_profile[$user]))
{
trigger_error('loadMemberContext(): member id ' . $user . ' not previously loaded by loadMemberData()', E_USER_WARNING);
return false;
}

// Well, it's loaded now anyhow.
$dataLoaded[$user] = true;
$profile = $user_profile[$user];

// Censor everything.
censorText($profile['signature']);
censorText($profile['personal_text']);
censorText($profile['location']);

Title: Re: 512: loadMemberContext()
Post by: Kindred on March 01, 2019, 08:20:59 AM
1- so, what version did you run before?
2- You did the whole upgrade, per this? https://wiki.simplemachines.org/smf/Upgrading
3- you removed your 1.1.x theme and set a 2.0.x theme?

 
Title: Re: 512: loadMemberContext()
Post by: -christian on March 06, 2019, 02:37:16 AM
Quote from: Kindred on March 01, 2019, 08:20:59 AM
1- so, what version did you run before?
2- You did the whole upgrade, per this? https://wiki.simplemachines.org/smf/Upgrading
3- you removed your 1.1.x theme and set a 2.0.x theme?
1- We came from the last 1.1.x
2- yes
3- yes
Title: Re: 512: loadMemberContext()
Post by: Arantor on March 06, 2019, 02:48:53 AM
If you look in the members table, does id 84 exist?
Title: Re: 512: loadMemberContext()
Post by: -christian on March 08, 2019, 05:28:38 AM
Nope, it does not exists in the database. The db maintenance and the repair routines of SMF are running and completing without any error.
Title: Re: 512: loadMemberContext()
Post by: Arantor on March 08, 2019, 05:35:36 AM
Ok, what happens with the following query:

SELECT COUNT(*) FROM smf_messages WHERE id_member = 84;
Title: Re: 512: loadMemberContext()
Post by: -christian on March 08, 2019, 05:45:31 AM
Quote from: Arantor on March 08, 2019, 05:35:36 AM
Ok, what happens with the following query:

SELECT COUNT(*) FROM smf_messages WHERE id_member = 84;
Must be

SELECT COUNT(*) FROM yabbse_messages WHERE id_member = 84

in our case, but the result is:

COUNT(*) 0
Title: Re: 512: loadMemberContext()
Post by: Arantor on March 08, 2019, 05:50:24 AM
Then I don't understand why you get the error you get.
Title: Re: 512: loadMemberContext()
Post by: -christian on March 25, 2019, 03:41:08 AM
Quote from: Arantor on March 08, 2019, 05:50:24 AM
Then I don't understand why you get the error you get.
Me either. But it is in our logs, thousand times  >:(
Title: Re: 512: loadMemberContext()
Post by: Doug Heffernan on March 25, 2019, 08:52:54 AM
Quote from: -christian on March 08, 2019, 05:28:38 AM
Nope, it does not exists in the database. The db maintenance and the repair routines of SMF are running and completing without any error.

Your error is occuring because of the members being deleted, but the posts remaining. Can you run this query to update the message tables so the posts can have a corresponding member ID for deleted users as well?

UPDATE smf_messages SET id_member = 0 WHERE NOT EXISTS
(SELECT id_member FROM smf_members WHERE smf_messages.id_member = smf_members.id_member )



P.s. Make a backup of the database first before you run the query.
Title: Re: 512: loadMemberContext()
Post by: Arantor on March 25, 2019, 06:37:22 PM
But we established that the relevant member didn't have any entries in the messages table...
Title: Re: 512: loadMemberContext()
Post by: shawnb61 on March 25, 2019, 08:23:35 PM
Random thought...  Is it possible the reference to user 84 is coming from a stored session?  Maybe accessed via a bot?
Title: Re: 512: loadMemberContext()
Post by: Doug Heffernan on March 26, 2019, 04:18:31 PM
Quote from: Arantor on March 25, 2019, 06:37:22 PM
But we established that the relevant member didn't have any entries in the messages table...

That is correct, however I think that said member has been deleted at some point but his/her posts remained in the database and for some reason are not correspoding. Running the query I posted will update the posts table and make sure that posts will have a corresponding member ID for deleted users. It is worth a shot imho.
Title: Re: 512: loadMemberContext()
Post by: -christian on May 07, 2019, 02:37:34 AM
That was a nice idea, worth a try but:

UPDATE yabbse_messages SET id_member = 0 WHERE NOT EXISTS (SELECT id_member FROM yabbse_members WHERE yabbse_messages.id_member = yabbse_members.id_member )
[b]Gefundene Zeilen: 0[/b]