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: "Rybacki, Jim" <jrybacki at citistreetonline dot com>
Subject: Trying to cycle through ~150 Servers -ct_con_alloc failed
Date: Sep 12 2002 4:08PM

I could use some help here.

	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.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 line 69.  (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. 
		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) (end)

		foreach (@servers){
			if ( ! $Server ){
				..... } update server down state
			else {
				Repos->close($Server)      ( which does a
CT_CLOSE on the dbh - does this work?).
			} (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
I was under the impression that once a dbh goes out of scope that the
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
Sybase DBA
Ph:   904.791.2900
Fax: 904.791-2169