Community discussions

MikroTik App
 
User avatar
SpectatorCN
newbie
Topic Author
Posts: 34
Joined: Tue Sep 23, 2008 9:40 pm
Location: Ukraine
Contact:

fetch error: maximal connection count reached

Mon Oct 11, 2010 12:07 am

Hi to all.
I am use a simple script like this:
/tool fetch mode=http address=10.0.0.1 src-path=("/test/index.php") dst-path="/commands.txt" port=80 host=host.com;

......
some code
......
}
Sheduler run it each 30 seconds.

But after a while the script has stopped request URL.
When I run from a terminal it gives this error: failure: maximal connection count reached

Why connection count reached?
And how to avoid it?
 
dssmiktik
Forum Veteran
Forum Veteran
Posts: 732
Joined: Fri Aug 17, 2007 8:42 am

Re: fetch error: maximal connection count reached

Mon Oct 11, 2010 5:59 am

I think there's a limit (maybe around 4 - 6 or so) of fetch instances that can run simultaneously.

Are the scripts ending, or do you see a many of the same scripts in /system script job print? I've seen some cases where fetch can take a long time if no data is being returned by the server.
 
User avatar
SpectatorCN
newbie
Topic Author
Posts: 34
Joined: Tue Sep 23, 2008 9:40 pm
Location: Ukraine
Contact:

Re: fetch error: maximal connection count reached

Mon Oct 11, 2010 11:58 pm

Yes you are right. Connection limit is 10.
For some reason I did not notice the hanging session in /system script job
They hang up if the http server returns nothing.
Thank you very much.
 
dssmiktik
Forum Veteran
Forum Veteran
Posts: 732
Joined: Fri Aug 17, 2007 8:42 am

Re: fetch error: maximal connection count reached

Tue Oct 12, 2010 8:37 pm

Glad it's working for you :-)
 
jaredharet
newbie
Posts: 31
Joined: Fri Feb 23, 2007 11:25 pm
Location: Bulgarian

Re: fetch error: maximal connection count reached

Mon Mar 04, 2013 12:06 am

Someone has found a solution ?
 
dbdom
just joined
Posts: 23
Joined: Sun Dec 09, 2012 9:51 pm

Re: fetch error: maximal connection count reached

Fri Nov 07, 2014 6:09 pm

I have the same problem with up/down script in netwatch - it uses "tool fetch mode=http ..." to update the web site showing status of over 200 monitored devices. When something wrong has happend and many of devices have been disconnected at the same time, netwatch scripts could not update status of all devices due "10 connection limit".
In my opinion this limit should be an option or has to be increased/disabled.
 
tazdevil
newbie
Posts: 29
Joined: Tue Oct 29, 2013 7:12 pm

Re: fetch error: maximal connection count reached

Mon Mar 16, 2015 7:19 am

Does anyone have a solution for this? I am having the same problem, it runs sometimes a few hundreds counts and sometimes it runs up to 20000 counts before /tool fetch fails to work.

Routerboard Firmware version: 3.18
Package version: 6.19

I've tried to upgrade both version to no avail.

Thanks.
 
dbdom
just joined
Posts: 23
Joined: Sun Dec 09, 2012 9:51 pm

Re: fetch error: maximal connection count reached

Mon Mar 16, 2015 5:56 pm

I added ":delay x " at the beginning of up/down script ( where x is the last digit of IP address of "netwatched" device) and it helped a little.
 
Feklar
Forum Guru
Forum Guru
Posts: 1724
Joined: Tue Dec 01, 2009 11:46 pm

Re: fetch error: maximal connection count reached

Mon Mar 16, 2015 6:24 pm

To get around this, you need to look at the number of scripts in the job tab, and if it is too many delete them. This will free up the HTTP sessions and allow you to continue to use fetch.
:local b 0
:foreach ENTRY in=([/system script job find script="<SCRIPT NAME>"]) do={:set b ($b + 1)}
:if ($b > 3) do={/system script job remove [find script="<SCRIPT NAME>"]}
 
tazdevil
newbie
Posts: 29
Joined: Tue Oct 29, 2013 7:12 pm

Re: fetch error: maximal connection count reached

Tue Mar 17, 2015 5:10 pm

There is only one "/tool fetch" job in the scripts. I have tried to run the script manually when it failed by clicking on "Run Script" button but it did not help. The only way to recover it is to reboot or power cycle the unit.
 
User avatar
villageworker
newbie
Posts: 38
Joined: Fri Nov 11, 2011 9:54 pm

Re: fetch error: maximal connection count reached

Wed Mar 18, 2015 8:39 am

I have a script MONITOR that runs every five minutes and occasionally gets stuck. Monitor should never run for more than a second.

So I have another script UNSTUCK scheduled to run very 3 minutes to delete the the MONITOR Script that is hung

This Unstuck script is:
/system script job remove [find where script="MONITOR"];


works for me.

Previous poster Feklar had a more generic and better script.
 
User avatar
nabilx
just joined
Posts: 23
Joined: Thu Jul 06, 2017 11:19 pm
Location: Syria, Hama
Contact:

Re: fetch error: maximal connection count reached

Sat Apr 24, 2021 9:47 pm

I know it's very old post but i had the same problem , rebooting the router solved it but many can't just reboot so just disable any scheduler that has fetch and remove jobs and enviroment from script tap , It worled for me.
 
dquive
just joined
Posts: 1
Joined: Fri Nov 24, 2023 11:44 pm

Re: fetch error: maximal connection count reached

Fri Nov 24, 2023 11:49 pm

I was having the same problem. It was solved with a simple reboot of the router.

Who is online

Users browsing this forum: Ahrefs [Bot], Amazon [Bot], Bing [Bot] and 139 guests