PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: Trying to cycle through ~150 Servers -ct_con_alloc failed
Date: Sep 13 2002 2:20PM

My guess is that the connection doesn't get cleaned up correctly.

Try enabling the full trace (via Sybase::CTlib::debug(0xffffffff)) and
see whether the connection gets cleaned up correctly.

Michael


On Thu, 2002-09-12 at 09:08, Rybacki, Jim wrote:
> I could use some help here.
> 
> Specifics:
> 	OS        : HP/UX 11.0
> 	Perl       : 5.005_03
> 	Sybperl  :sybperl-2.14
> 	CT-LIB   : Sybase Client-Library/11.1.1/P-EBF8061
> 	Sybase  : 11.0.0.3 -> 11.9.2
> 
> The problem:
> 	I'm trying to cycle through approximately 150 Sybase
> 	servers on seperate machines in order collect information.
> 	After about 4 interations of the server loop I receive the 
> 	following error:
> 		ct_con_alloc failed at Server.pm line 69.
> 
> 	Server.pm  (code snippet)
> 
> 	In an attemp to catch the sybase warning (?)  for 'connection to two
> endpoints failed'
> 	I placed the following in my callback procedure and try to catch it
> with an eval on the
> 	new (ct_connect) command. 
> 
> 	Server.pm 
> 		Callback routine:
> 		...
> 		if ( $severity = 5 && $number=3 ){
>          			die "Server unreachable\n";
> 		}
> 
> 		Repos new (server object)
>             	
> Line 69		eval { local $SIG{'__DIE__'} ; $dbh = new Sybase::CTlib
> $user, $PWD , $server_name, $appname } ; 
>  		if ( $@ || ! defined ($dbh) ) {
>       			print "a=$@\n";
>       			return (0);
>  		}	
> 	 	$obj = {  _dbh => $dbh,          # Database Handle
>                    		_user => $user,        # User name
>                		_name => $server_name };    # Server name	
> 		bless $obj;
> 		return ($obj)
> 
> 	Server.pm (end)
> 
> 	ping.pl
> 
> 		@servers=get_server_list();
> 		foreach (@servers){
> 			$Server=$Repos->new(......);
> 			if ( ! $Server ){
> 				..... } update server down state
> 			else {
> 				Repos->close($Server)      ( which does a
> CT_CLOSE on the dbh - does this work?).
> 			}
> 	ping.pl (end)
> 
> The UNIX box has 20GB of memory so I don't this is a memory problem (per
> CTLIb man). I've
> looked at the CTLIb.c code, RTFM, and tried many combos of this -to no
> avail. 
> I was under the impression that once a dbh goes out of scope that the
> resources 
> are released.(??)
> 
> Anyway, I would really like to get loop this to work (not just for a ping).
> 
> Does anyone have a suggestion ?
> 
> Thanks in advance,
> Jim Rybacki
> Citistreet
> Sybase DBA
> Ph:   904.791.2900
> Fax: 904.791-2169
> E-Mail: jrybacki@citistreetonline.com
> 
-- 
Michael Peppler / mpeppler@peppler.org / http://www.mbay.net/~mpeppler
mpeppler@zetatools.com / ZetaTools, Inc / http://www.zetatools.com
ZetaTools: Call perl functions as Sybase stored procedures!