Summary | lots of "DB Error: unknown error: INSERT INTO" when Horde_Cache is enabled |
Queue | Horde Base |
Queue Version | 3.2.2 |
Type | Bug |
State | Resolved |
Priority | 1. Low |
Owners | jan (at) horde (dot) org |
Requester | tek (at) dgap (dot) mipt (dot) ru |
Created | 07/15/2009 (5834 days ago) |
Due | |
Updated | 08/14/2009 (5804 days ago) |
Assigned | 07/20/2009 (5829 days ago) |
Resolved | 08/14/2009 (5804 days ago) |
Github Issue Link | |
Github Pull Request | |
Milestone | |
Patch | No |
http://cvs.horde.org/diff.php/framework/Perms/Perms/datatree.php?rt=horde&r1=1.6.2.23&r2=1.6.2.24&ty=u
http://cvs.horde.org/diff.php/framework/Perms/Perms/sql.php?rt=horde&r1=1.1.2.14&r2=1.1.2.15&ty=u
http://cvs.horde.org/diff.php/horde/docs/CHANGES?rt=horde&r1=1.515.2.546&r2=1.515.2.547&ty=u
Assigned to Jan Schneider
State ⇒ Resolved
http://cvs.horde.org/diff.php/framework/Perms/Perms/datatree.php?rt=horde&r1=1.46&r2=1.47&ty=u
http://cvs.horde.org/diff.php/framework/Perms/Perms/sql.php?rt=horde&r1=1.15&r2=1.16&ty=u
http://cvs.horde.org/diff.php/horde/docs/CHANGES?rt=horde&r1=1.1248&r2=1.1249&ty=u
horde/lib/Horde/Cache/sql.php
function set($key, $data, $lifetime = null)
{
...
$result = $this->_write_db->query($query, $values);
if (is_a($result, 'PEAR_Error')) {
// debug
debug_print_backtrace();
print "<br>\n********$data#######<br>\n";
//debug
Horde::logMessage($result, __FILE__, __LINE__, PEAR_LOG_ERR);
return false;
}
return true;
}
we'll find for these type of errors:
[imp] DB Error: unknown error:
INSERT INTO horde_cache (cache_id, cache_timestamp, cache_expiration,
cache_data)
VALUES ('8c2efd26a50e2900dc587d3922519a65', 1249954083, 1250040483, FALSE)
[nativecode=ERROR: column "cache_data" is of type text but expression
is of type boolean HINT: You will need to rewrite or cast the
expression.]
[pid 4142 on line 226 of
"/var/www/localhost/htdocs/horde/lib/Horde/Cache/sql.php"]
backtraces like these:
#0 Horde_Cache_sql->set(perm_exists_imp:create_folders, ) called at
[/var/www/horde_test/htdocs/horde/lib/Horde/Perms/datatree.php:202]
#1Perms_datatree->exists(imp:create_folders) called at[/var/www/horde_test/htdocs/horde/imp/lib/IMP.php:876]
#2IMP::hasPermission(create_folders) called at[/var/www/horde_test/htdocs/horde/imp/lib/IMP.php:588]
#3IMP::flistSelect(Messages to, 1, Array (), , 1, 1, , 1) called at[/var/www/horde_test/htdocs/horde/imp/mailbox.php:304]
********#######
#0 Horde_Cache_sql->set(perm_exists_imp:max_folders, ) called at
[/var/www/horde_test/htdocs/horde/lib/Horde/Perms/datatree.php:202]
#1Perms_datatree->exists(imp:max_folders) called at[/var/www/horde_test/htdocs/horde/imp/lib/IMP.php:876]
#2IMP::hasPermission(max_folders) called at[/var/www/horde_test/htdocs/horde/imp/lib/IMP.php:589]
#3IMP::flistSelect(Messages to, 1, Array (), , 1, 1, , 1) called at[/var/www/horde_test/htdocs/horde/imp/mailbox.php:304]
********#######
There are two ways to storage permissions: datatree and sql.
If we change backend for permissions to sql, then errors will disappear.
If we compare code for "Perms_[datatree/sql]->set()":
horde/lib/Horde/Perms/sql.php
------------------
function exists($permission)
{
$key = 'perm_exists_' . $permission;
$exists = $this->_cache->get($key,
$GLOBALS['conf']['cache']['default_lifetime']);
if ($exists === false) {
$this->_connect();
$query = 'SELECT COUNT(*) FROM horde_perms WHERE perm_name = ?';
$exists = $this->_db->getOne($query, array($permission));
if (is_a($exists, 'PEAR_Error')) {
return $exists;
}
$this->_cache->set($key, $exists);
}
return (bool)$exists;
}
horde/lib/Horde/Perms/datatree.php
-------------------
function exists($permission)
{
$key = 'perm_exists_' . $permission;
$exists = $this->_cache->get($key,
$GLOBALS['conf']['cache']['default_lifetime']);
if ($exists === false) {
$exists = $this->_datatree->exists($permission);
$this->_cache->set($key, $exists);
}
return (bool)$exists;
}
It seems that reason for errors is lack of return value check in
horde/lib/Horde/Perms/datatree.php
after "$exists = $this->_datatree->exists($permission)" call before
"_cache->set()" like in Perms/sql.php backend.
Simple workaround.
Change backend for permission from datatree to SQL , login to the
horde to create entries for create_folders, max_folders, change driver
back to datatree.
State ⇒ Feedback
more recent version first.
Priority ⇒ 1. Low
Type ⇒ Bug
Summary ⇒ lots of "DB Error: unknown error: INSERT INTO" when Horde_Cache is enabled
Queue ⇒ Horde Base
Milestone ⇒
Patch ⇒ No
State ⇒ Unconfirmed
with PostgreSQL backend. Everything seems to be working just fine, but
in logs, i got a lot of error messages on horde_cache tables:
[horde] DB Error: unknown error: INSERT INTO horde_cache (cache_id,
cache_timestamp, cache_expiration, cache_data) VALUES
('6ce9d5bdf7e6e1eee4e790cbd156b7af', 1247666680, 1247753080, FALSE)
[nativecode=ERROR: column "cache_data" is of type text but expression
is of type boolean HINT: You will need to rewrite or cast the
expression.] [pid 32594 on line 226 of
"/var/www/localhost/htdocs/horde/lib/Horde/Cache/sql.php"]
...
[imp] DB Error: unknown error: INSERT INTO horde_cache (cache_id,
cache_timestamp, cache_expiration, cache_data) VALUES
('e629f174ffe682593097290b886eaae2', 1247672866, 1247759266, FALSE)
[nativecode=ERROR: column "cache_data" is of type text but expression
is of type boolean HINT: You will need to rewrite or cast the
expression.] [pid 3025 on line 226 of
"/var/www/localhost/htdocs/horde/lib/Horde/Cache/sql.php"]
What other info is needed to fix this problem?