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

Random Stream timed out #114

Closed
juanfcomartin opened this issue Apr 19, 2024 · 2 comments
Closed

Random Stream timed out #114

juanfcomartin opened this issue Apr 19, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@juanfcomartin
Copy link

Version of RouterOS
RouterOS 7.8 running on CCR2116-12G-4S+

To Reproduce

$client = new Client([
            'host' => $config['host'],
            'user' => $config['user'],
            'pass' => $config['password'],
            'port' => intval($config['port']),
        ]);
$query = new Query('/ip/firewall/filter/print');
$response = $client->query($query)->read();

Expected behavior
From time to time, I get the "Stream timed out" error when calling $client->query($query)->read(). It really isn't a timeout issue as I'm sniffing the traffic and I can see that the communication is taking place and the client is receiving the request from RouterOS but for some reason, an exception is launched inside ResourceStream:

if(socket_get_status($this->stream)['timed_out']){
            throw new StreamException('Stream timed out');
}
@juanfcomartin juanfcomartin added the bug Something isn't working label Apr 19, 2024
@EvilFreelancer
Copy link
Owner

Hi! I guess you increased socket_timeout option from default 30 seconds and solved your issue.

@bangyadiii
Copy link

I have the same problem. With the same code, sometimes it works, sometimes it doesn't.

My configuration looks like this:


return [
...
    'attempts'        => 5,   // Count of attempts to establish TCP session
    'delay'           => 1,    // Delay between attempts in seconds
    'timeout'         => 65,   // Max timeout for instantiating connection with RouterOS
    'socket_timeout'  => 60,   // Max timeout for read from RouterOS
    'socket_blocking' => false, // Set blocking mode on a socket stream
..
]

My RouterOS version is 7.14.1 (CHR Mikrotik)

FYI, I moved to this . It worked for me. No more random stream error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants