Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto close tunnel if interupted or exited #104

Open
Loocos opened this issue Aug 19, 2023 · 5 comments
Open

Auto close tunnel if interupted or exited #104

Loocos opened this issue Aug 19, 2023 · 5 comments
Assignees

Comments

@Loocos
Copy link

Loocos commented Aug 19, 2023

Hi,

We always need to do tunnel:close when the tunnel got exited when a rebuild is done on the environment or if we CTRL+C

It would be great to close the tunnel in this both case.

Is there any reason of this behaviour ?

Thanks

@pjcdawkins pjcdawkins self-assigned this Aug 19, 2023
@pjcdawkins
Copy link
Contributor

I'm not sure how to reproduce the issue.

Is this with tunnel:single?

@Loocos
Copy link
Author

Loocos commented Aug 23, 2023

@pjcdawkins Exactly yes

@Loocos
Copy link
Author

Loocos commented Aug 23, 2023

I've updated my CLI to the latest version (4.8.6) through Scoop and it get worst. Now I can't open tunnel anymore...

After opening the tunnel using tunnel:single, I quit it with CTRL + C, try to reopen and get :

$ platform tunnel:single
Fatal error: Uncaught TypeError: fclose(): Argument #1 ($stream) must be of type resource, bool given in phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/vendor/symfony/process/Pipes/WindowsPipes.php:74
Stack trace:
#0 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/vendor/symfony/process/Pipes/WindowsPipes.php(74): fclose()
#1 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/vendor/symfony/process/Process.php(1371): Symfony\Component\Process\Pipes\WindowsPipes->__construct()
#2 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/vendor/symfony/process/Process.php(281): Symfony\Component\Process\Process->getDescriptors()
#3 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/vendor/symfony/process/Process.php(209): Symfony\Component\Process\Process->start()
#4 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/vendor/symfony/process/Process.php(234): Symfony\Component\Process\Process->run()
#5 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/Service/Shell.php(224): Symfony\Component\Process\Process->mustRun()
#6 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/Service/Shell.php(128): Platformsh\Cli\Service\Shell->runProcess()
#7 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/CredentialHelper/Manager.php(336): Platformsh\Cli\Service\Shell->execute()
#8 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/CredentialHelper/Manager.php(115): Platformsh\Cli\CredentialHelper\Manager->exec()
#9 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/ApiToken/CredentialHelperStorage.php(30): Platformsh\Cli\CredentialHelper\Manager->get()
#10 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/Service/TokenConfig.php(34): Platformsh\Cli\ApiToken\CredentialHelperStorage->getToken()
#11 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/Service/Api.php(270): Platformsh\Cli\Service\TokenConfig->getApiToken()
#12 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/Service/Api.php(445): Platformsh\Cli\Service\Api->getConnectorOptions()
#13 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/Service/Api.php(1162): Platformsh\Cli\Service\Api->getClient()
#14 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/Service/Api.php(593): Platformsh\Cli\Service\Api->getHttpClient()
#15 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/Command/CommandBase.php(697): Platformsh\Cli\Service\Api->getProject()
#16 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/Command/CommandBase.php(1055): Platformsh\Cli\Command\CommandBase->getCurrentProject()
#17 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/Command/CommandBase.php(1587): Platformsh\Cli\Command\CommandBase->selectProject()
#18 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/Command/Tunnel/TunnelSingleCommand.php(36): Platformsh\Cli\Command\CommandBase->validateInput()
#19 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/vendor/symfony/console/Command/Command.php(255): Platformsh\Cli\Command\Tunnel\TunnelSingleCommand->execute()
#20 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/vendor/symfony/console/Application.php(1010): Symfony\Component\Console\Command\Command->run()
#21 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/Application.php(347): Symfony\Component\Console\Application->doRunCommand()
#22 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/vendor/symfony/console/Application.php(255): Platformsh\Cli\Application->doRunCommand()
#23 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun()
#24 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/bin/platform(32): Symfony\Component\Console\Application->run()
#25 C:\Users\flore\AppData\Local\Temp\psh-go-8.0.29-4.8.6\psh-4.8.6(10): require('...')
#26 {main}
  thrown in phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/vendor/symfony/process/Pipes/WindowsPipes.php on line 74

And if I try to close it (which was working before) :

$ platform tunnel:close
Fatal error: Uncaught TypeError: fclose(): Argument #1 ($stream) must be of type resource, bool given in phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/vendor/symfony/process/Pipes/WindowsPipes.php:74
Stack trace:
#0 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/vendor/symfony/process/Pipes/WindowsPipes.php(74): fclose()
#1 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/vendor/symfony/process/Process.php(1371): Symfony\Component\Process\Pipes\WindowsPipes->__construct()
#2 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/vendor/symfony/process/Process.php(281): Symfony\Component\Process\Process->getDescriptors()
#3 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/vendor/symfony/process/Process.php(209): Symfony\Component\Process\Process->start()
#4 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/vendor/symfony/process/Process.php(234): Symfony\Component\Process\Process->run()
#5 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/Service/Shell.php(224): Symfony\Component\Process\Process->mustRun()
#6 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/Service/Shell.php(128): Platformsh\Cli\Service\Shell->runProcess()
#7 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/CredentialHelper/Manager.php(336): Platformsh\Cli\Service\Shell->execute()
#8 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/CredentialHelper/Manager.php(115): Platformsh\Cli\CredentialHelper\Manager->exec()
#9 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/ApiToken/CredentialHelperStorage.php(30): Platformsh\Cli\CredentialHelper\Manager->get()
#10 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/Service/TokenConfig.php(34): Platformsh\Cli\ApiToken\CredentialHelperStorage->getToken()
#11 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/Service/Api.php(270): Platformsh\Cli\Service\TokenConfig->getApiToken()
#12 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/Service/Api.php(445): Platformsh\Cli\Service\Api->getConnectorOptions()
#13 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/Service/Api.php(1162): Platformsh\Cli\Service\Api->getClient()
#14 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/Service/Api.php(593): Platformsh\Cli\Service\Api->getHttpClient()
#15 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/Command/CommandBase.php(697): Platformsh\Cli\Service\Api->getProject()
#16 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/Command/CommandBase.php(1055): Platformsh\Cli\Command\CommandBase->getCurrentProject()
#17 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/Command/CommandBase.php(1587): Platformsh\Cli\Command\CommandBase->selectProject()
#18 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/Command/Tunnel/TunnelCommandBase.php(265): Platformsh\Cli\Command\CommandBase->validateInput()
#19 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/Command/Tunnel/TunnelCloseCommand.php(33): Platformsh\Cli\Command\Tunnel\TunnelCommandBase->filterTunnels()
#20 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/vendor/symfony/console/Command/Command.php(255): Platformsh\Cli\Command\Tunnel\TunnelCloseCommand->execute()
#21 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/vendor/symfony/console/Application.php(1010): Symfony\Component\Console\Command\Command->run()
#22 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/src/Application.php(347): Symfony\Component\Console\Application->doRunCommand()
#23 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/vendor/symfony/console/Application.php(255): Platformsh\Cli\Application->doRunCommand()
#24 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun()
#25 phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/bin/platform(32): Symfony\Component\Console\Application->run()
#26 C:\Users\flore\AppData\Local\Temp\psh-go-8.0.29-4.8.6\psh-4.8.6(10): require('...')
#27 {main}
  thrown in phar://C:/Users/flore/AppData/Local/Temp/psh-go-8.0.29-4.8.6/psh-4.8.6/vendor/symfony/process/Pipes/WindowsPipes.php on line 74

Hope it helps you figure out

@Loocos
Copy link
Author

Loocos commented Aug 25, 2023

The error is gone after uninstall/install and clear cache.
But the behaviour of closing the tunnel everytime is still there. Is there any reason of that?

@pjcdawkins
Copy link
Contributor

The fclose() error seems to be related to the CredentialHelper not the tunnels (thanks for pasting the backtrace).

But the behaviour of closing the tunnel everytime is still there. Is there any reason of that?

Sorry I still don't understand what happens here. What does the tunnel:single output show when the environment is rebuilt, or on ctrl+C?

For me (on Linux) the command exits when the SSH connection breaks:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants