Hello,
I'm quite stuck with a little problem since yesterday night: my modules
that load SQL connections at start time just crash connecting to the
database.
I reduced the problem to the following little module. Just change the
sql path for your own setup in start() and please tell me where i'm
wrong:
----8<----8<----8<----8<----
#include <module.h>
inherit "module";
inherit "caudiumlib";
constant cvs_version = "$Id$";
constant module_type = MODULE_FIRST;
constant module_name = "Test: SQL at start time";
constant module_doc =
"<p>This module tries to load a SQL connection at start time.</p>";
constant module_unique = 1;
constant thread_safe = 1;
// Global
object sql_con;
/* Caudium API */
// Module startup and restart handler
void start(int count, object conf)
{
if(!sql_con)
{
// Change that for your own use
sql_con =
Sql.Sql("mysql://user:pass AT localhost/database");
}
}
string status()
{
string out = "";
if(sql_con)
{
out += "tables:";
out += sprintf("%O", sql_con->query("SHOW TABLES"));
}
return out;
}
mixed first_try(object id)
{
// Do nothing for now
return 0;
}
---->8---->8---->8---->8----
Here's what gdb on darwin tells me:
----8<----8<----8<----8<----
Reading symbols for shared libraries . done
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000004
[Switching to process 10297 thread 0x2903]
low_mapping_lookup (m=0x0, key=0xf0143698) at
/sw/src/fink.build/pike7.6-7.6.112-2/Pike-v7.6.112/src/mapping.c:1095
1095
/sw/src/fink.build/pike7.6-7.6.112-2/Pike-v7.6.112/src/mapping.c: No
such file or directory.
in
/sw/src/fink.build/pike7.6-7.6.112-2/Pike-v7.6.112/src/mapping.c
(gdb) bt
#0 low_mapping_lookup (m=0x0, key=0xf0143698) at
/sw/src/fink.build/pike7.6-7.6.112-2/Pike-v7.6.112/src/mapping.c:1095
#1 0x00095a44 in low_mapping_lookup (m=0x0, key=0xf0143698) at
/sw/src/fink.build/pike7.6-7.6.112-2/Pike-v7.6.112/src/mapping.c:1091
Previous frame identical to this frame (corrupt stack?)
---->8---->8---->8---->8----
Archive powered by MhonArc 2.6.16.