Community discussions

MikroTik App
 
User avatar
pekr
Member Candidate
Member Candidate
Topic Author
Posts: 169
Joined: Tue Feb 22, 2005 9:05 pm
Location: Czech Republic
Contact:

4.6 - API session user not removed from active user list ...

Sun Apr 25, 2010 3:13 pm

Hi,

just doing some experiments with API using REBOL language, and found out that each time I log, no matter how do I terminate the session ("/quit" or just closing the TCP port), I can see the list of API (demo) users is growing. I noticed that this bug was fixed in 3.25. But I am doing my tests on 4.6 - I just wonder if the fix did not get it to 4.6 branch, or I am doing something wrong?

Thanks,
Petr
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: 4.6 - API session user not removed from active user list

Sun Apr 25, 2010 3:23 pm

Seems like a common problem for the V4.x OS. Another user is having exactly the same problem with V4.7.
http://forum.mikrotik.com/viewtopic.php?f=9&t=37075
I recommend the same for you. Run the script a few times to get a few active users in the list, then make a supout file and email to support (at) mikrotik.com with a short explanation of the problem, and what you have tried.
 
User avatar
pekr
Member Candidate
Member Candidate
Topic Author
Posts: 169
Joined: Tue Feb 22, 2005 9:05 pm
Location: Czech Republic
Contact:

Re: 4.6 - API session user not removed from active user list

Sun Apr 25, 2010 3:40 pm

OK, I can send suppout file, but I think that they know what the bug is about. Taken from 3.25 changelog:

*) api - closed sessions were not removed from the '/user active' list;

From the thread you suggested, it is not clear what version was the user using ....

EDIT: btw - this happens from python API wrapper, as well as from my REBOL tests, so I think I am not doing anything wrong with REBOL ...

-pekr-
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: 4.6 - API session user not removed from active user list

Sun Apr 25, 2010 3:45 pm

I thought it was clear.
(snip) RouterOS v4.7
This user tried with a couple different languages, with exactly the same result.
 
User avatar
martini
Member Candidate
Member Candidate
Posts: 296
Joined: Tue Dec 21, 2004 12:13 am

Re: 4.6 - API session user not removed from active user list

Sun Apr 25, 2010 9:53 pm

confirm this bug
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: 4.6 - API session user not removed from active user list

Mon Apr 26, 2010 4:05 am

have you tested previous versions? at least in v4.2 all is still okay
 
User avatar
omidkosari
Trainer
Trainer
Posts: 640
Joined: Fri Sep 01, 2006 4:18 pm
Location: Canada, Toronto

Re: 4.7 - API session user not removed from active user list

Mon Apr 26, 2010 8:37 am

Ok . i will follow my other thread http://forum.mikrotik.com/viewtopic.php?f=9&t=37075 here because this board is more popular .
I am also using http://wiki.mikrotik.com/wiki/API_PHP_class . it worked good but after some hours API returned cannot get challenge and then script could not connect to API anymore .
Another strange thing is , i have seen a lot of sessions in "/user active print" . there are more than 44500 :shock: sessions there from user which i used for API connection but i have used $API->disconnect () .
RouterOS v4.7
You aren't following that example literally, are you? It does a login, one command, then logs out. You can log in once, do as many commands as you need to do, then disconnect (logout) once when you are finished for the session.
The script runs each time the specific page hits by a user so it should login , execute the command and then logout . the only way is a persistent connection with something like CURL or pfsockopen which needs customization of API_PHP_Class .
Maybe a "/quit" command sent just before the disconnect might drop the user from the active list.
Tried but unfortunately not worked :(
I have also test with mikrotik official python api client . it has same problem and does not clear the admin from "/user active print" .
even after sending /quit . with /quit it successfully closes the connection and raises "connection closed by remote end" but the admin is still remains alive at "/user active print" .
The problem is not just the growing number of active sessions . the main problem is cannot get challenge after some hours and then unable to connect to API
 
User avatar
omidkosari
Trainer
Trainer
Posts: 640
Joined: Fri Sep 01, 2006 4:18 pm
Location: Canada, Toronto

Re: 4.6 - API session user not removed from active user list

Mon Apr 26, 2010 9:25 am

I received a reply from Mikrotik Support
Hello,


Thank you for the report. We are aware of this problem and it will be fixed in
next version. Currently only option to clear active users is to reboot the
router.


Regards,
Maris


Just for share
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: 4.6 - API session user not removed from active user list

Mon Apr 26, 2010 4:11 pm

anyway, it's about active users, not challenge...
 
User avatar
omidkosari
Trainer
Trainer
Posts: 640
Joined: Fri Sep 01, 2006 4:18 pm
Location: Canada, Toronto

Re: 4.6 - API session user not removed from active user list

Mon Apr 26, 2010 9:36 pm

anyway, it's about active users, not challenge...
ummmmmmmmm . you mean "cannot get challenge" will not solve ?!
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: 4.6 - API session user not removed from active user list

Tue Apr 27, 2010 3:28 am

I mean, I don't see any connection between those two things...
 
escentrix
just joined
Posts: 4
Joined: Wed May 26, 2010 4:47 pm

Re: 4.6 - API session user not removed from active user list

Thu Nov 04, 2010 3:40 pm

I am still seeing this problem in RouterOS version up to V4.13. Using the newest PHP API, when I open a connection I see the Active Users list increase by 1 with an "unknown" field in the 'Via' column. I am using the disconnect() function at the end of the communication, but I do not see the user ever get removed. Eventually this list will get very large with tens of thousands of active users.

I will be resubmitting this bug to the support guys just to make sure they are aware.

@Chupaka
This is when the "cannot get challenge" comes into play. It seems when the API creates enough active users the board will start refusing any more connection attempts. Turning debug on in the API returns this string. The two seem to be linked in this way from my tests.
 
dssmiktik
Forum Veteran
Forum Veteran
Posts: 732
Joined: Fri Aug 17, 2007 8:42 am

Re: 4.6 - API session user not removed from active user list

Thu Nov 04, 2010 9:34 pm

This is when the "cannot get challenge" comes into play. It seems when the API creates enough active users the board will start refusing any more connection attempts. Turning debug on in the API returns this string. The two seem to be linked in this way from my tests.
Not really. The core issue (api connections not being cleared), should not be related to api challenge. The api challenge problem is only the side effect of multiple api connections (ex. when not cleared out). The underlying issue is that the api connections are not being cleared on disconnect. This is a known problem, and Mikrotik know about it already. They say it will be fixed in v5.x
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: 4.6 - API session user not removed from active user list

Thu Nov 04, 2010 11:25 pm

this IS fixed in v5, but it's still RC...
 
ispsoft
just joined
Posts: 2
Joined: Sun Jun 27, 2010 7:07 pm

Re: 4.6 - API session user not removed from active user list

Wed Dec 01, 2010 6:28 pm

I'm currently using 5.0v and the problems remains... any suggestion ?
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: 4.6 - API session user not removed from active user list

Thu Dec 02, 2010 12:35 pm

I'm currently using 5.0v and the problems remains... any suggestion ?
v5.0rc4 is definitely removes logged-out API connections. what exact version do you use?
 
ispsoft
just joined
Posts: 2
Joined: Sun Jun 27, 2010 7:07 pm

Re: 4.6 - API session user not removed from active user list

Thu Dec 02, 2010 9:37 pm

I'm currently using v5.0rc4 ... after 10 or maybe 12 operations the mikrotik returns a message like ".. Already have such name" and the connection made within Users\Active remains there and the via is "unknown"... we are currently modifying queues and this application is working fine in mikrotik up to 4.2 ! ... Trying to working around I made some modification to connection software generating different tags in each operation but the problem remains.

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Semrush [Bot] and 40 guests