detection and resolving of blocking functions ...
| From: | Christophe VG | Date: | Wed, 28 Nov 2001 07:57:15 +0000 |
| Subject: | detection and resolving of blocking functions ... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-75855@lists.php.net to get a copy of this message | ||
Hi,
I originally posted this message to the php-db list, but I think that
although this seems originally an oracle related problem ... there must
be a "PHP solution" to it.
What I'm looking for is a way to "detect" and "destroy" or
"interrupt" a
blocking function. Below, in the example in the original post, the
OCIServerVersion function just hangs the entire application when the
network connection is removed, and I find no way to overcome this.
If you have any experiences regarding this kind of problems, please let
me know, as this is starting te become a major blocker ;-)
Thanks a lot in advance ...
Christophe VG
---
Hi,
While writing an app that regularly checks an oracle database for new
entries I run into problems when the database server suddenly goes
offline (the network connection can't be trusted).
The call right after such a connection loss just hangs the application.
Here is a little example to illustrate ...
<?
ob_implicit_flush();
$cnn = OCILogon( 'scott', 'tiger' );
function valid_cnn( &$cnn ) {
return ( trim( OCIServerVersion($cnn) ) != '' );
}
while( true ) {
print valid_cnn( $cnn ) ? "OK\n" : "DOWN\n";
sleep(1);
}
?>
Running it results in a nice collection of "OK"'s and a hangup when I
disconnect the network. Plugging the network back in resumes the series
of "OK"'s after a while ... But the desired behaviour ( "DOWN" ) won't
appear.
Did anyone of you encountered a similar situation ? How did you solve
this ? ... Any ideas are good, since I'm a bit stuck and any lead might
help to a probably very simple solution (that I just can see rigth now)
Thanks in advance,
Christophe VG