Archived Forum Post

Index of archived forum posts

Question:

SSH Tunneling thread not response

May 11 '17 at 16:35

Hello,

I have a connection to mysql through an SSH tunnel which works without problems opening and closing the tunnel + Mysql connection in every transaction in the PHP application.

However after a while, the thread that is attempted to close upon completion of a task generates the following error:

ChilkatLog: StopAccepting: DllDate: Mar 23 2017 ChilkatVersion: 9.5.0.66 UnlockPrefix: Anything for 30-day trial. Architecture: Little Endian; 64-bit Language: Linux PHP VerboseLogging: 0 Stopping listen thread... Listen thread did not stop. Failed. --StopAccepting --ChilkatLog

my code sample

include("chilkat_9_5_0.php");
$chilkatGlob = new CkGlobal();
$success = $chilkatGlob->UnlockBundle('Anything for 30-day trial.');
if ($success != true) {
    print $chilkatGlob->lastErrorText() . "\n";
    exit;
}
$tunnel = new CkSshTunnel();
$sshHostname = 'SSH server client side';
$sshPort = 7001;
//  Connect to an SSH server and establish the SSH tunnel:
$success = $tunnel->Connect($sshHostname,$sshPort);
if ($success != true) {
    print $tunnel->lastErrorText() . "\n";
    exit;
}
$success = $tunnel->AuthenticatePw('jan','jan12');
if ($success != true) {
    print $tunnel->lastErrorText() . "\n";
    exit;
}
$tunnel->put_DestPort(3306);
$tunnel->put_DestHostname('mysql local server IP');
$listenPort = 3307;
$success = $tunnel->BeginAccepting($listenPort);
if ($success != true) {
    print $tunnel->lastErrorText() . "\n";
    exit;
}else{
    echo 'conectado';
}

//My mysql script executed by the application

//  Stop the background listen/accept thread:
$waitForThreadExit = true;
$success = $tunnel->StopAccepting($waitForThreadExit);
if ($success != true) {
    print $tunnel->lastErrorText() . "\n";
    exit;
}
//  Close the SSH tunnel (would also kick any remaining connected clients).
$success = $tunnel->CloseTunnel($waitForThreadExit);
if ($success != true) {
    print $tunnel->lastErrorText() . "\n";
    exit;
}

Any ideas? I think that something may be missing to close the SSH session correctly, causing the thread to not be closed.


Answer

Thanks Jan,

I think v9.5.0.67 may fix the problem. I'll post a build here when it's ready. (likely later today)


Answer

What version of PHP are you using?


Answer

Here is a new build you can try: https://chilkatdownload.com/prerelease/chilkat-9.5.0-php-5.4-x86_64-linux.tar.gz