Hi everybody. I'm using Authcache and it worked fine after the initial setup in my development box. However, after restarting the computer, and I guess once the cache has been cleared, I cannot open the site anymore, all I see is this message:
PDOException: SQLSTATE[42804]: Datatype mismatch: 7 ERROR: argument of AND must be type boolean, not type integer LINE 4: WHERE (type & '128') AND (access_callback <> '0') AND (acce... ^: SELECT DISTINCT m.tab_root AS tab_root FROM {menu_router} m WHERE (type & :db_condition_placeholder_0) AND (access_callback <> :db_condition_placeholder_1) AND (access_callback <> :db_condition_placeholder_2) AND (access_callback <> :db_condition_placeholder_3) AND (access_callback <> :db_condition_placeholder_4) AND (access_callback <> :db_condition_placeholder_5) AND (access_callback <> :db_condition_placeholder_6) AND (access_callback <> :db_condition_placeholder_7) ; Array ( [:db_condition_placeholder_0] => 128 [:db_condition_placeholder_1] => 0 [:db_condition_placeholder_2] => 1 [:db_condition_placeholder_3] => user_access [:db_condition_placeholder_4] => user_is_anonymous [:db_condition_placeholder_5] => user_is_logged_in [:db_condition_placeholder_6] => user_register_access [:db_condition_placeholder_7] => search_is_active ) en authcache_menu_tab_root_blacklist() (line 191 of /www/sites/all/modules/authcache/modules/authcache_menu/authcache_menu.module).
The reported version is 7.x-2.0-alpha4+7-dev (downloaded yesterday) with Drupal 7.23. The site is using PostrgreSQL 9.1.9 as database, not MySQL. Could that be the problem?
Any advice is welcome, many thanks in advance!
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 2110129-do-not-use-binary-and-in-select-query.patch | 2.97 KB | znerol |
Comments
Comment #1
proteo commentedA quick follow-up:
I disabled the menu module with drush:
$ drush pm-disable authcache_menu
And I was able to open and browse the site normally. Reenabled the module and the error is back. However, I discovered two interesting things:
Comment #2
znerol commentedThank you for this report. Attached is a rewrite of the affected function which does not rely anymore onto the binary & in the SQL query.
Do you perhaps have a chance to run the authcache-test-suite against PostgreSQL? That could probably reveal additional cross-platform bugs.
Comment #3
znerol commentedComment #4
proteo commentedThanks for the quick response. I applied the patch and at first look everything works great, the error is gone. I'll perform the testing suite and report back.
Best regards.
Comment #5
proteo commentedHi again znerol, I finally had the time to setup a site to run the testing. In the development site I didn't enable all Authcache submodules, but in the testing site I did enable them all except Authcache Varnish since I don't have Varnish installed. First thing I noticed is that these new error messages appear (the page is loaded fine, though):
Warning: Missing argument 2 for authcache_usercookie_authcache_cookie() en authcache_usercookie_authcache_cookie() (línea 12 de /www/sites/all/modules/authcache/examples/authcache_usercookie/authcache_usercookie.module).Notice: Undefined variable: account en authcache_usercookie_authcache_cookie() (línea 13 de /www/sites/all/modules/authcache/examples/authcache_usercookie/authcache_usercookie.module).Notice: Use of undefined constant AUTHCACHE_FLAGS_ACCOUNT_ENABLED - assumed 'AUTHCACHE_FLAGS_ACCOUNT_ENABLED' en authcache_usercookie_authcache_cookie() (línea 14 de /www/sites/all/modules/authcache/examples/authcache_usercookie/authcache_usercookie.module).Notice: Object of class stdClass could not be converted to int en authcache_usercookie_authcache_cookie() (línea 14 de /www/sites/all/modules/authcache/examples/authcache_usercookie/authcache_usercookie.module).Clearing the caché didn't help, so I disabled the Authcache User Cookie module and proceed with the testing. Again, I checked all submodules in the admin testing screen except Varnish. The site is translated to spanish, but the reported results are something like this:
3470 pass, 2 failures, 5663 exceptions, and 983 depuration messagesThe two failures were found in one single test, "Cache backend". I'll copy here only the entries labeled as errors:
Message: X-Drupal-Cache header should be absent, when request was not delivered through authcache builtin backend.
Group: Other
File name: authcache_builtin.cache-backend.test
Line: 86
Function: AuthcacheBuiltinTestCacheBackend->testDeliverThroughBackend()
Message: X-Drupal-Cache header should be absent, when request was delivered through the test frontcontroller but without having specified that the backend should be used.
Group: Other
File name: authcache_builtin.cache-backend.test
Line: 90
Function: AuthcacheBuiltinTestCacheBackend->testDeliverThroughBackend()
Anyway, where other SQL errors popped up was in the "Default Request Handler", "Fragment Assembly Request
", "Fragment Request" and "Setting Request" tests (part of the Authcache Personalization set). These tests threw all 5663 exceptions (most of them just say Illegal string offset 'filename') but these SQL errors were reported several times as well:
PDOException: SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "simpletest63481locales_source" does not exist LINE 1: SELECT s.lid, t.translation, s.version FROM simpletest63481l... ^: SELECT s.lid, t.translation, s.version FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language WHERE s.source = :source AND s.context = :context AND s.textgroup = 'default'; Array ( [:language] => es [:source] => Value @first is equal to value @second. [:context] => ) en locale() (línea 720 de /www/modules/locale/locale.module).I think it has something to do to the testing procedure and not with the module itself, but I wanted to report it anyway.
From what I gather, none of these messages are related to the database code of Authcache (or I think so). Since I ran the test using the patched authcache_menu.module file, I was curious to see whether the test actually would catch the error reported before (datatype mismatch). I reverted to the unpatched version (made sure I actually see the error message) and ran the test again, this time only for the authcache menu module. Effectively, the test failed and the SQL error popped up several times.
This makes me think that after the patch on #2 it's safe to assume that there are no more SQL incompatibilities so far, at least with PostgreSQL.
I hope you'll find some helpful information here. If you want me to do more testing, I'll be more than glad to help.
Best regards.
Comment #6
znerol commentedThank you very much for this report.
Regarding Authcache User Cookie: This is a code-example. I did not update it for a while. However this reminds me that I probably should move it out of of the "Performance and scalability" package and give it a more descriptive name.
The two failures in the "Cache backend" test likely are happening because you ran the test-suite on an installation where you had the
authcache_builtin.cache.inccache backend hardwired insettings.php. When running tests, no contrib modules should be enabled and settings.php file should not be customized beyond the bare minimum (i.e. hash salt and database parameters).I'm not sure what I should think about the locale-related failures. When I began to write tests, I somehow picked up the bad practice to use t() for assert-messages. This is discouraged for obvious reasons e.g. here. However if the exceptions would be related to that, then I'd expect a lot more failures all over the place.
Nice, this encourages me for writing more tests.
Thanks again for your detailed feedback, it is very appreciated.
Comment #7
znerol commentedOk, closing this. Relevant commits:
Comment #8
proteo commentedHi again znerol. Been really busy last days, but just for the peace of mind: as you mentioned I did have that line in settings.php. I didn't know it would cause problems, sorry, but after removing it effectively the test comes out perfectly clean :)
Best regards.
Comment #8.0
proteo commentedApparently, whether the page is previously cached or not has nothing to do with the issue.