-
Notifications
You must be signed in to change notification settings - Fork 101
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
Reader + Processor threads #55
Comments
I'm trying to work this out but am having a hard time reproducing the error.
I think possible causes should be a form of timeout after a successful login, or a command that fails in an unexpected way (and basically 'hangs' the connection until it times out). Questions: Can you please provide me with the following:
|
Hi, Answer for your question Commands, that are being used in current job are Exception messages that occures at line 68
Stack traces:
|
I am using 8 threads that takes list of ips and for each one they call this method (with some additional logic of loading and saving Device object from database).
|
I’ve been super busy at work so I have not been able to look at this.
I will try to find some time on the weekend.
Gideon
… On 20 Jul 2018, at 16:54, dangelcz ***@***.***> wrote:
I am using 8 threads that takes list of ips and for each one they call this method (with some additional logic of loading and saving Device object from database).
public static void loadDevice(Device device, String ip, String login, String pwd)
{
String rscCmd = MikrotikCommands.resources();
Map<String, String> response = MikroticApi.processCmd(rscCmd, ip, login, pwd);
device.ros_version = response.get("version");
device.architecture = response.get("architecture-name");
String rtbCmd = MikrotikCommands.routerboard();
response = MikroticApi.processCmd(rtbCmd, ip, login, pwd);
device.current_firmware = response.get("current-firmware");
device.serial_number = response.get("serial-number");
device.upgrade_firmware = response.get("upgrade-firmware");
}
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub <#55 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ABFCFMiLrYUyT5aKuzKwvmCwUQLc19NUks5uIe8TgaJpZM4VPkh2>.
|
I know what is wrong and will fix it. Not an easy fix though, may require some internal re-write. |
Hi, I managed to repair problems myself at the weekend. Its working well, but it looks more like hack than nice architecture repair. I’m still busy and have no time to tell you full details. I’ll try to create pull request tommorow so you can check my changes. So, main problem seems to be, that Reader thread stucks on in.read() in Util.decode() method and later becomes zombie thread, which cannot be killed or stopped. I still don’t know how is it possible, because in Connection.close() I addeed reader.join() which goes through without any problems, so reader should have ended, but in some cases don't.
Main changes I made:
There are some more changes, but those are mentionable. Maybe, you' ll find some clue for your analysis and patch. |
You are correct, the problem is that I've committed a very simple patch that sets the Can you please try the following:
Maybe it helps you. If it works better, I will push that fix to master. Gideon |
Hi, I made some tests with this branch, set timeout to 20 seconds, but there is no difference. Threads stuck at the same places as before even if I wait more than 2 minutes after main procedure completes (I removed setDeamon(), so VM won't cancel) I think, that reading stucks due to half closed socket, which should throw exception, but won't. Stack traces (15 seconds because I took image early, but it contined) I was not able to prepare pull request, because applying changes without my refactor did not work well. So I uploaded whole project as is to googledrive at least, if you want to see. This version works well for me. |
that is the best way |
for all you can dependecy |
|
Hi,
first of all I want to thank you for this great api implementation, I really appreciate it.
I'm using your api for managing devices over small city network (about 1500 devices). For that purpouse, I wrote small java program, that provides batch changes. Problem I got is about closing/terminating your Reader and Processor threads. After running one of my jobs, which checks configuration of 739 devices, there are 216 threads alive just before program ends, which is problem, because my monitoring server runs out of resources. Here you can see screen captured from VisualVM on my development PC
For sending commands through your api, I am using following code
I am suspicious of that problem occures when there is some connection problem like ip unreachable, timeout or unable to login. Thats where some inner exception occures and after that, close method does not work properly and threads stuck on reading from empty stream.
Thanks in advance for your help.
The text was updated successfully, but these errors were encountered: