Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: michael dot peppler at bnpparibas dot com
Subject: Re: Sybase not closing connection when scripts is terminated
Date: Aug 23 2007 12:14PM

The most likely problem is the setting of the tcp keep_alive kernel 
parameter. This parameter controls how much time is required before the OS 
realizes that a connection is "dead" when one of the parties has 

Under linux this is controled via the /etc/sysctl.conf file, for example:

# Keepalive settings for Sybase.
net.ipv4.tcp_keepalive_time = 600
net.ipv4.tcp_keepalive_intvl = 10
net.ipv4.tcp_keepalive_probes = 5

The default values for these parameters usually specify a timeout of 
several days... You should check with the system administrator of your 
system for details regarding how to configure this.


Internet - 23.08.2007 14:04
Sent by:
To:     sybperl-l
Subject:        Sybase not closing connection when scripts is terminated

Good Morning,

I using DBI-1.34/DBD-Sybase-0.95 to access Sybase servers, using Sybase
client 11.5.1, regular CGI/command line scripts (No Mod Perl, etc.).
Running against ASE

I'm trying to understand a problem that occur very infrequently (once
every 2 month, on a very busy server). Each time the problem occur on
different script, but the pattern is the same:
- Script get launched.
- Issuing a query that result in large results set - Read Only
- Script is aborted with Signal (or Ctrl/C).
- Script is terminated.
- Sybase Server does not detect that the script is not running any more
- READ ONLY locks remain from the query.
- Another scripts is running 12-24 hours later - trying to update/insert
- get locked forever.

At the time of the problem, Sybase is showing open connection (sp_who)
to the process. We verified that the process is not running on the
server (using ps), and does not have any forked children that may have
kept the connection open.

I suspect that the core problem is that Sybase server is unable to
detect closed connection, when it is in the middle of sending the result
set to the client, but I could not replicate the problem.

Any help with the following questions will be appreciated:
- Does anyone know/experience similar problem - and know the source ?
- Is there any setting that can be used to say "Abort transaction if it
can not be executed in  seconds" ?
- Any way to force Sybase to actively check if the client is alive every


Yair Lenga

This message and any attachments (the "message") is intended solely for the addressees and is confidential. 
If you receive this message in error, please delete it and immediately notify the sender. Any use not in accord with 
its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. 
The internet can not guarantee the integrity of this message. 
BNP PARIBAS (and its subsidiaries) shall (will) not therefore be liable for the message if modified. 
Do not print this message unless it is necessary, consider the environment.
Ce message et toutes les pieces jointes (ci-apres le "message") sont etablis a l'intention exclusive de ses destinataires et sont confidentiels. Si vous recevez ce 
message par erreur, merci de le detruire et d'en avertir immediatement l'expediteur. 
Toute utilisation de ce message non conforme a sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse.
L'internet ne permettant pas d'assurer l'integrite de ce message, BNP PARIBAS (et ses filiales) decline(nt) toute responsabilite au titre de ce message, dans l'hypothese ou il aurait ete modifie.
N'imprimez ce message que si necessaire, pensez a l'environnement.