Forum OpenACS Development: nsfreetds query causes aolserver to stop responding

Posted by Ryan Gallimore on
I have successfully installed Freetds 0.62.1 and the nsfreetds 0.4 driver on OpenACS 5.1.4, and I can even run queries on my MSDE 7 database from a tcl page, but around 15 minutes after I do so aolserver stops responding; the processes don't crash, the site just does not respond to requests. There are no errors in the log. I am running Red Hat Enterprise Linux 2.32 on Intel.

I don't think it's the driver load itself, since after a restart, the site is fine... until I run a query:

db_foreach -dbn yardi get_query {
  select semail from tenant
} {
  ns_write "$semail,"

The query works.

Here are the relevant lines from config.tcl:

ns_section "ns/db/drivers"
  ns_param freetds ${bindir}/

ns_section ns/server/${server}/acs/database
    ns_param database_names [list main yardi]
    ns_param pools_main  [list pool1 pool2 pool3]
    ns_param pools_yardi [list yardi]

ns_section ns/db/pool/yardi
  ns_param driver      freetds
  ns_param connections  1
  ns_param user        username
  ns_param password    password
  ns_param datasource  yardi ;#datasource name in freetds.conf file
  ns_param verbose      off

ns_section ns/server/${server}/db
    ns_param  pools              "*"
    ns_param  defaultpool        pool1

When I first ran the query I got an "Unknown driver '$driver_type'" error, so I edited 00-database-procs.tcl below to add the nsfreetds driver. I realize there's some parameter in config.tcl that should take care of this for me, but adding the following lines seemed to work:

        # These are the default driverkey values, if they are not set
        # in the config file:

        if { [string equal $driver {Oracle8}] } {
            set driverkey {oracle}
        } elseif { [string equal $driver {PostgreSQL}] } {
            set driverkey {postgresql}
        } elseif { [string equal $driver {ODBC}] } {
            set driverkey {nsodbc}
      } elseif { [string equal $driver {nsfreetds}] } {  ; # added this
          set driverkey {freetds}
        } else {
            set driverkey {}
            ns_log Error "$proc_name: Unknown driver '$driver_type'."

One other thing - when compiling nsfreetds-0.4, I got an undefined function error for tds_set_charset. I commented this call out completely in nsfreetds.c (since I could find it nowhere else) and it compiled fine.

Any idea what's causing aolserver to stop responding to requests fifteen minutes after I successfully run a query on my SQL database?
Did one of my modifications screw things up?
Is there some timeout parameter I am missing in my config file?

Thank you in advance for your help!