Subject Interserver chokes on 4 day connection
Author davcamer
I have a small java daemon which queries an ibserver through
interserver/interclient every 30 seconds. (It's a TimerTask.) The
DbInterface module for the daemon creates the connection once, and
then keeps it around in a static variable. I don't keep track of the
number of reuses of the connection, but after approximately 4 days of
continuous uptime, something in ibserver/interserver/interclient
chokes on the connection.I have now changed my program to close the
connection and reopen it every 2 hours. I was still wondering though,
if this is a known problem and if there is a more graceful workaround
for it.

Interserver is being run out of xinetd with the following config:
# default: on
# description: Interserver, java JDBC for Interbase/Firebird
service interserver
{
disable = no
type = UNLISTED
port = 3060
protocol = tcp
socket_type = stream
wait = no
user = root
server = /opt/interbase/interclient/interserver
server_args = -l
log_type = FILE /opt/interbase/interclient/xinetd.log
log_on_success += PID
log_on_success += HOST
log_on_success += USERID
log_on_success += EXIT
log_on_success += DURATION
log_on_failure += USERID
log_on_failure += HOST
per_source = UNLIMITED
}

interbase was installed from the FirebirdSS-1.0.0.681-0.RC2 package
from ibphoenix.com
interserver/interclient was installed from the
interclient_201_linux-xinetd.tar.gz file also from ibphoenix.com The
readme in the package is dated 2 Nov 2001

Here's a snippet from the xinetd.log for interserver along with a
snippet from interbase.log

------ xinetd.log -------
02/2/11@11:04:50: START: interserver pid=726 from=192.168.0.151
02/2/14@07:22:09: EXIT: interserver signal=13 pid=726
duration=245839(sec)
02/2/15@14:40:03: START: interserver pid=2424 from=192.168.0.151
02/2/18@10:58:52: EXIT: interserver signal=13 pid=2424
duration=245929(sec)

------ interbase.log ------
ns2.com (Client) Thu Feb 14 07:21:09 2002
/opt/interbase/bin/ibguard: bin/ibserver terminated abnormally
(-1)


ns2.com (Client) Thu Feb 14 07:21:09 2002
/opt/interbase/bin/ibguard: guardian starting bin/ibserver


ns2.com (Server) Mon Feb 18 10:55:52 2002
gds__free: pool corrupted

ns2.com (Client) Mon Feb 18 10:55:52 2002
gds__free: pool corrupted

ns2.com (Client) Mon Feb 18 10:56:52 2002
gds__free: pool corrupted

ns2.com (Server) Mon Feb 18 10:57:22 2002
gds__free: pool corrupted

ns2.com (Client) Mon Feb 18 10:57:22 2002
gds__free: pool corrupted

ns2.com (Server) Mon Feb 18 10:57:52 2002
gds__alloc: memory pool corrupted


ns2.com (Client) Mon Feb 18 10:57:52 2002
/opt/interbase/bin/ibguard: bin/ibserver terminated abnormally
(-1)


ns2.com (Client) Mon Feb 18 10:57:52 2002
/opt/interbase/bin/ibguard: guardian starting bin/ibserver

Here's the java code being used to make the connection to the
database:
private static Connection dbConnection = null;
private static void makeConnection() throws SQLException{
DataSource dataSource = new interbase.interclient.DataSource();

String userid = "sysdba";
String password = "pescado";

dataSource.setNetworkProtocol("jdbc:interbase:"); /* set the network
protocol */
dataSource.setServerName("192.168.0.151"); /* the hostname or IP
address of the server */
dataSource.setDatabaseName("/opt/interbase/smsd.gdb"); /* the full
path
to your database file */
dataSource.setDataSourceName("SomeName"); /* a descriptive name */
dataSource.setDescription("SomeDescription"); /* a descriptive
comment */
dataSource.setPortNumber(3060); /* the TCP port Interclient listens
on
by default */
dataSource.setRoleName(null); /* set the Interbase role to use */
dataSource.setLoginTimeout(60); /* set the login timeout to 10
seconds */


dbConnection = dataSource.getConnection(userid,password);
}


The java program ends up throwing exceptions after interbase has
choked. The exceptions start with:
SQL Error Code:335544327SQL State: ICI00SQL Message:
[interclient][interbase]
invalid request handle
Stack trace follows:
interbase.interclient.SQLException: [interclient][interbase] invalid
request
handle

and eventually proceed to:
SQL Error Code:1SQL State: ICJE7SQL Message: [interclient]
Communication error:
An IO exception occurred while trying to send data to server
192.168.0.151.
The message of the IOException is "Broken pipe".
See API reference for exception
interbase.interclient.CommunicationException
Stack trace follows:
interbase.interclient.CommunicationException: [interclient]
Communication
error: An IO exception occurred while trying to send data to server
192.168.0.151.
The message of the IOException is "Broken pipe".
See API reference for exception
interbase.interclient.CommunicationException


That's all I can think of to post. If someone is interested in
tracking down the problem I can help out with more info et cetera.
It's not a pressing problem, as I think closing and reopening the
connection after 2 hours will solve the problem, but really, I should
be able to keep it open as long as I wish.

Dave