Download & Extend

Views causing error "Table 'watchdog' was not locked with LOCK TABLES'

Project:Views
Version:5.x-1.6
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Hi. I don't know why but after I moved my site to a new server, from PHP 4 to PHP 5 and from Mysql 4 to Mysql 5, Views is causing this error:

Warning: Table 'watchdog' was not locked with LOCK TABLES query: INSERT INTO watchdog (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (1, 'php', '<em></em> in <em>/home/username/domains/domain.org/public_html/includes/database.mysql.inc</em> on line <em>172</em>.', 2, '', 'http://www.example.org/', '', 'myip', 1216802025) in /home/username/domains/domain.org/public_html/includes/database.mysql.inc on line 172

After one day trying to figure it out what was causing the problem I disabled every module one by one in the 'system' table and after I disabled views the problem disappeared. Views related modules were enabled to see if any of them were causing the problem, but no, they weren't.

Some data you must need to know.

I have a custom view to replace the frontpage.
I have 65+ views in my site.
This is not a php memory problem since I have 250 MB enabled (Do I need more than this?).
I'm Using PHP 5 and Mysql 5
Views Related Modules Enabled: Views-Bonus, Views Fusion, Editable Fields.
System Up to date, every module is up to date.

I tried clearing the cache table but still nothing.

I found several nodes related to "Table 'watchdog' was not locked with LOCK TABLES" but none of them worked for me. Most of them were referring to php memory issues.

One more thing. I have multisites enabled for this domain, they are sharing the same modules (sites/all/modules) but one of the sites is also using Views and shows no error at all. They are in a different database and this site has 3 views.

I'm lost. What can I do next?

Thanks in advance.

Luis

Comments

#1

I truncated the following tables:

view_argument, view_exposed_filter, view_filter, view_sort, view_tablefield, view_view and the problem is solved.

So now I know there's a view causing the problem.. But if I have more than 65 views, what can I do to know which one is causing the problem?

Is there any way to disable a view, not delete it?

Thanks

Luis

#2

I created a backup of the table view_view. Then I clean up the table. Then I started to add every single view using the code in the backup.

For a minute I detected that 3 views where causing the problem, but not really, because those views were being executed in the frontpage... now I know that every view is corrupted or something since once I execute the view I get errors..

Any solution?

Thanks

Luis

#3

Have you tried truncating cache_views?

#4

Yes I did and it didn't work.

The problem it's not in a particular view, since when I tried to create a new view I got the "Table 'watchdog' was not locked with LOCK TABLES' error.

I uninstalled views and then after installing it again I got

Warning: Got a packet bigger than 'max_allowed_packet' bytes query

Looking in phpmyadmin the "MySQL Server variables and settings" I got the value for max allowed packet which is:

max allowed packet  1,048,576

I haven't talked to my hosting provider to see if there's any chance they can change this value to 32MB, I want to see if there's no other errors and if that is actually the cause of the problem.

I haven't found any way to change this without having access to the my.cnf file, if there's any way to do this please let me know.

What I'm going to do next is trying to recover the site from an old backup and try to replicate the problem in my own home server.

Any other advice would be appreciated.

Luis

#5

I Couldn't replicate the error in my home server... Everything works great, no problem at all, updated to the last version of drupal and no problem there, updated all the modules and no problem there.. Maybe the problem is with the hosting..

I will try to upload everything again.

Luis

#6

I created a patch that ensures that the error message is stored correctly in the watchdog table:
#298768: Ensure that entries are written to watchdog table

Unfortunately this doesn't solve your real problem.

#7

Did you find the resolution to this yet? We just started running into this today.

#8

Not really. The hosting provider said it was a problem related to php 4, but I never knew, I had the site running in my localhost with php 5x, then I migrated to php 4 and everything went ok till they moved my site to a server running php5x.. they did this twice and it didn't work so they moved the site to the server running php4 and the problem went away...

but I don't think this could be a solution. Something I never tried back then was truncating every cache table "before" doing the db backup and then migrate. I remember truncating the cache views related tables but not all the cache tables, and I did it "after" I migrated, not before. Seems like a good idea to clear this tables before doing the backup.

#9

Status:active» closed (fixed)

Given the age of this issue, I have to presume it is either no longer relevant, or fixed.

nobody click here