Notifications
Clear all

[Closed] WPFORO creating deadlocks in MySQL

3 Posts
2 Users
0 Reactions
330 Views
Posts: 2
Topic starter
(@wcgtech)
New Member
Joined: 8 months ago

Does anyone have any experience with wpforo creating DB deadlocks?  Specifically I'm running into it deadlocking on the wpforo_phrases table.

Its trying to run an INSERT IGNORE, I get the error 'Waiting for table level lock' and then it continues to run, quickly filling up DB connections.  I have no other code interacting with the wpforo_phrases table, just the plugin.  I do have the polls addon, no other addons. 

Any insight would be awesome.  I've repaired and recreated the table.  It seems to happen at random times , but once the first deadlock occurs, it spirals quickly.

It is not frequent and I can usually solve be completely stopping and starting my DB server, but thats far from ideal

 

2 Replies
Posts: 2
Topic starter
(@wcgtech)
New Member
Joined: 8 months ago

If it helps - I've isolated it to this section of code in the Phrases.php file.

if( $langid ) {
	foreach( $vals as $val ) {
		if( isset( $val['tag'] ) && $val['tag'] == 'PHRASE' && isset( $val['attributes']['NAME'] ) && trim( (string) $val['attributes']['NAME'] ) && isset( $val['value'] ) && trim( (string) $val['value'] ) ) {
			$sql = "INSERT IGNORE INTO `" . WPF()->tables->phrases . "` 
					(`phraseid`, `langid`, `phrase_key`, `phrase_value`)
					VALUES( NULL, 
							'" . intval( $langid ) . "', 
						 '" . esc_sql( stripslashes( htmlspecialchars_decode( (string) $val['attributes']['NAME'], ENT_QUOTES ) ) ) . "', 
							'" . esc_sql( stripslashes( htmlspecialchars_decode( (string) $val['value'], ENT_QUOTES ) ) ) . "')";
			WPF()->db->query( $sql );
		}
	}
	return $langid;
}

 
dimalifragis
Posts: 2609
(@dimalifragis)
Famed Member
Joined: 4 years ago

Nobody has reported something like this. Usually it is some plugin, hard to find. Very hard. I had one issue like that and since it happened once in a while, it was impossible to find the cause.

Luckily someone reported also the same with a plugin i used and after removing it, the issue is gone.

Also is your DB engine version updated?