-
Notifications
You must be signed in to change notification settings - Fork 15
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
Database error #145
Comments
I'm not sure how this is related to the WP Plugin, these saves are happening on your server, right ? |
@coreymckrill Could you provide some more color on this? We're struggling to understand what part of the plugin might be causing this problem on our setup. |
It was happening more frequently for a while, but the last time it happened was on May 19 (probably right before I created this issue). Our Papertrail logs only go back to the 13th, so I don't have any other examples right now. My interpretation of the error message is that for some reason it is trying to add a Member ID to the wp_memberful_mapping table that already exists. Since the member_id field is a primary key for that table, it can't have duplicates. So somehow the plugin is failing to detect that the user account already exists before it tries to create a new one. Since it's happening so sporadically, my guess is that this is occurring when a user logs into the site, triggering the plugin's user sync function. |
I can notice a function in there. public function map( $member, array $context = array() ) {
$existing_user_with_members_email = get_user_by( 'email', $member->email );
$mapping_from_member = $this->repository()->find_user_member_is_mapped_to( $member );
$mapping_from_user = $this->repository()->find_member_user_is_mapped_to( $existing_user_with_members_email );
//......
} $sql =
'SELECT `mem`.`wp_user_id`, `mem`.`member_id` '.
'FROM `'.Memberful_User_Mapping_Repository::table().'` AS `mem`'.
'WHERE `mem`.`member_id` = %d'; File path : wp-content/plugins/memberful-wp/src/user/map.php I think this is happening if that user had his email address changed... OR if there's 2 users with the same email address ? |
Ok, we just had another instance of the error:
The rest of the call stack is the same as above. I looked up the Perhaps the I'm not sure where this gets us, but it's more information to add to the puzzle. |
Is the error itself a blocker ? Or more like an notice, looking into solutions right now, and want to figure exactly what happens. @coreymckrill |
It's a PHP error, but it's clearly not crashing our site. It may be terminating the active request, but I don't know of a good way to test that. The user data is also successfully making it into the database (perhaps because it was inserted without error before the request that throws the error). We haven't received any customer reports of things crashing out on them. So it may be that this is a fairly inconsequential issue... Here's something interesting: the function that is actually throwing the error mentions that this might happen because of a race condition: https://github.com/memberful/memberful-wp/blob/develop/src/user/map.php#L390-L417 |
This is related to #153, and it should referenced as such. |
We are periodically getting errors like this in our logs on the Theme Foundry site:
The text was updated successfully, but these errors were encountered: