Subject: | Lost Connections cannot be restored |
If a connection is established using Kx and subsequently lost, it cannot
be restored. The connections are stored in the private class variable
%DB. On the first connection, a record is defined in %DB. Any subsequent
connections are tested to see if they're defined there, and if they are
the old handle is returned without checking to see if the handle is
still good or not.
There is no way to modify this variable, and no published disconnect
mechanism, which would be useful if there are a lot of connections or
file descriptor exhaustion is a concern.
Patch attached adds logic to test the handle and undefine it if it's
bad, thereby forcing the reconnect.
Subject: | Kx.pm.roddis-connect.patch |
183a184,191
> if(defined $DB{$name}{'kdb'})
> {
> # Check to see if the connection is alive. If it's not
> # make it undef to force the reconnect
> my $result = $DB{$name}{'kdb'}->cmd("1b");
> delete ( $DB{$name} ) unless ( $result );
> }
>