SSH connections in non-blocking mode fail with invalid parameter
#209
Labels
bug
Confirmed as a valid bug and requires fix.
invalid parameter
#209
Summary
When you connect using the TS3PHPFramework via the classic "raw" way to your TeamSpeak server in the non-blocking mode, so that you can use it as bot, everything works as expected. When you simply change the port and
ssh=0
tossh=1
, the PHP script starts failing within less than 5 minutes. At least in my test scenario.Environment
dev
:83a2ffaace6073ca2589881a764625f2993996bc
)ssh2
1.4How to reproduce
dev
branchcomposer install
test.php
script in the root folder with the following content:When I run it with the TCP port
10011
(classic "raw") and the optionssh=0
, everything works as expected - no issues:As you can see: The script was running without any issues for over 19.5 hours (1180 minutes).
However, when you change the TCP port from
10011
to10022
(encryptedSSH
) and the option fromssh=0
tossh=1
it fails for my TeamSpeak server mostly within 5 minutes:This issue is always reproducible for me.
Current behaviour
The bot works as expected via the classic "raw" connection.
The bot fails with the exception
invalid parameter
when it tries to get any list via a SSH connection.Expected Behaviour
The bot should be properly able to get any list via a SSH connection as it does with the classic "raw" connection.
Additionals notes
*List()
functions of the TS3PHPFrameworkinvalid parameter. ident 'cldbid' does not exist in node '{"_identifier":"+GPk+IrgHZUQ7Vu6aY0mGgtseNw="}
(the node looks always a bit different, but always incomplete like this one)ssh=1
, we use the PHP functionsssh2_connect()
andssh2_shell()
:ts3phpframework/src/Transport/TCP.php
Line 82 in 83a2ffa
fwrite()
:ts3phpframework/src/Transport/TCP.php
Line 182 in 83a2ffa
fgets()
:ts3phpframework/src/Transport/TCP.php
Line 154 in 83a2ffa
blocking=0
:ts3phpframework/src/Adapter/ServerQuery.php
Lines 169 to 171 in 83a2ffa
ssh2_shell()
a comment mentions, thatstream_set_blocking()
should be set totrue
, but we always set it tofalse
:ts3phpframework/src/Transport/TCP.php
Line 90 in 83a2ffa
@stream_set_blocking($this->stream, true);
does unfortunately not solve the issue. Instead it stucks in a very CPU intensive endless loop, wherevar_dump($data)
returnsbool(false)
. So it does somehow not break / exit thewhile()
loop.The text was updated successfully, but these errors were encountered: