I previously posted a message on the forum, but I think it might fit better here.
Edit:
Initially I reported this as a PostgreSQL bug, but as described below at least MySQL can be affected as well.
Yesterday I updated Drupal from 7.9 to 7.10 (installed the site with 7.9). Since that update on every page load, PostgreSQL (my preferred database) spits out the following lines in the error log:
Dec 7 11:01:07 server4 postgres[11113]: [2-1] ERROR: syntax error at or near "WHERE" at character 32
Dec 7 11:01:07 server4 postgres[11113]: [2-2] STATEMENT: SELECT 1 AS expression
Dec 7 11:01:07 server4 postgres[11113]: [2-3] FROM
Dec 7 11:01:07 server4 postgres[11113]: [2-4]
Dec 7 11:01:07 server4 postgres[11113]: [2-5] WHERE ( (cid IS NULL ) ) FOR UPDATE
There are no errors or notices in Apache's error_log or Drupals logs, so I can't specify the line of code that triggers the error. The site (that is currently not in production) seems to function properly, maybe a bit sluggish, but that's too subjective to be certain. I am certain these errors did not appear in 7.9.
I did a diff -ruN on 7.9 and 7.10 and found that the only changed code that references cid in any way is this commit, which in turn links back to this issue.
I think a bug crept in with that code, but I hope someone closer to the project can shed some light on this.
FreeBSD 8.2
Apache 2.2.21
PHP 5.3.8 now 5.3.9 (without safe mode, with open_basedir and custom upload_tmp_dir)
PostgreSQL 9.0.5, now 9.0.6.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | Drupal7.10.patch | 4.39 KB | OliverH |
Comments
Comment #1
dema502 commentedsubscribe
Comment #2
dshelley66 commentedI'm seeing exactly the same behaviour with MySQL on Win7 and also on Ubuntu 10.10. I'm doing a clean install of Drupal 7.10 with the Standard profile.
After the new site is installed, if you turn on mysql query logging (set global general_log='on') and then do a page refresh, you will see the bad query noted above (i.e. FROM clause has no tables listed). I'm trying to figure out if this also have the side effect of disabling the anonymous page cache....
Comment #3
joeredhat-at-yahoo.com commentedI am also seeing this as well, on PostgreSQL on a new installation on either Fedora or RHEL.
Comment #4
Pimmy commentedIs there still no fix for this problem? Or anyone knowing what is the root cause?
Regards,
Pimmy
Comment #5
drupdan3 commentedTo add some information: if you set a non-empty Drupal table prefix (e.g. prefix_), you would see
STATEMENT: SELECT 1 AS expression FROM prefix_ WHERE ( (cid IS NULL ) ) FOR UPDATE
So some Drupal function tries to access a table with a null name!
I can't reproduce this error UNLESS I stress the site, e.g.
ab -n 1000 -c 30 http://www.mysite.com/news/
(apt-get install apache2-utils in Debian/Ubuntu)
The Devel module has an option to append all SQL queries with their source to the generated page. It doesn't help me because I can only generate the error when stress-testing the site. Can someone who always gets the error post a log? Just enable the Devel module and turn on query logging.
Note: more generally, I am seeing serious problems with db caching when I stress-test Drupal using ab (to the point that the cache becomes so corrupted the site won't load, and I have to manually clean it in psql -- not even drush will bootstrap). I am guessing db caching is not reliable at this point.
Comment #6
drupdan3 commentedI was mistaken -- the error occurs on every page indeed, and it also occurs under MySQL. The headers for this issue should probably be adjusted.
Comment #7
drupdan3 commentedDrupal 7.10 generates broken SQL (tries to access table with empty name) on every page load.
Reproducible in default install (no caching), MySQL, new site with a single article. Since it's impossible to tell what operation fails, AND I'm seeing corruption under heavy load, I'm bumping this to major.
The error happens right at the very end of the page generation. MySQL log:
There is no PHP error, and the page seems to render correctly (but heavy load + caching causes corruption, to the point drush won't bootstrap -- possibly unrelated issue). Devel module's SQL log doesn't show the error, presumably because rolled-back queries aren't shown.
Is there a way to add a PHP assertion to check that DB queries don't try to access the table '' (and get a backtrace on error)?
Comment #7.0
OliverH commentedClarify that the problem is not necessarily restricted to PostgreSQL
Comment #8
OliverH commentedI used the devel module as well, but like drupdan3 was not able to really learn anything from it.
Right now, I'd like to know whether this issue affects all installations (and people are disregarding their logs) or that the issue affects only some installations.
If you can verify that your installation is not affected, please tell.
If your installation is affected, report:
- Which database and which version of it you are running.
- Which version of PHP you are running.
- Which http-server you are running and which version of it.
Comment #9
drupdan3 commented@OliverH: any user can make those changes, and I *mentioned* I would do so (and explained why) in my previous comment. No developer has touched the issue thus far.
MySQL doesn't highlight this error in any particular way in the logs, it treats it as "business as usual". PostgreSQL makes more noise about it, which is why we noticed it.
I doubt this has anything to do with the particular db back-end. This error is (most likely) above the db abstraction layer.
Comment #9.0
drupdan3 commentedUpdate software versions
Comment #10
OliverH commentedThat's a tremendous amount of trust they bestow upon us simple users.
Still, the developers have to get a clear a picture as possible, so reporting software and their version numbers is still a very sensible thing to do.
Can you link to the MySQL doc explaining how MySQL-users can find this problem in their logs?
Comment #11
heine commentedThis is a bug in the visibility modifiers in DrupalCacheArray.
See #1371484: Private properties in abstract class DrupalCacheArray.
Comment #12
OliverH commentedI can confirm, the last patch mentioned there fixes 7.10 for me.
Comment #13
drupdan3 commented@OliverH: that patch doesn't seem to apply cleanly to the D7.10 stable release; are you using the -dev release, or the git version?
Comment #14
OliverH commentedI applied it to the 7.10 release by hand. I excluded the test-stuff. The attached patch should apply cleanly to your 7.10 installation.
Use at your own risk of course
Comment #14.0
OliverH commentedRemove part about devvers knowing, apparently this tracker is wide open to vandalization