Closed pimgeek closed 6 years ago
This is also the case for me (though different OS and Java 1.8.0_181) using DrawFBP v2.14.2.
It fully saturates one CPU core.
As far as I can see using a syscall trace, it is constantly doing a poll on a file description, then immediately trying to read from it and most of the time gets back -1 EAGAIN (Resource temporarily unavailable)
.
Running this in an actual Java debugger would show the cause in more detail.
Not sure what "poll" means. Also Googling this problem suggests EAGAIN only happens on a "write" - which I guess is not the case... I found this: https://groups.google.com/forum/#!topic/linux.debian.user/yMLyIeDMsZ8 , but it involves Debian - maybe not the same problem...? Anyway, I don't get any errors when running Eclipse debug - can you suggest how I can switch this on...? TIA
Regarding polling:
But the program does not wait for an event to happen, but tries to immediately do a read on the file descriptor and gets an error because no event has arrived yet ... and keeps getting an error until finally an event arrives.
To sum it up, the program seems to be in a loop checking for input events or constantly redrawing the display area or something similar.
Does DrawFBP maybe have a main loop or event loop which could be constantly busy?
Interestingly, when running the .jar in the Java debugger, it does not behave that way... but when running the .jar regularly without enabling debugging, then it saturates a CPU core, running in a loop:
poll, read with error, read with error, read with error, .... read with success (finally received an event) ... poll again, read with error, read with error, read with error, ....read with success etc.
I will also check this more in-depth.
Thanks, Ernst! I suspect this involves Java Swing's event-handling. I use invokeLater
for some of the focus stuff and I have quite a lot of Listeners looking out for various events. There is no main loop...
The problem may be too many repaints - see https://stackoverflow.com/questions/49136035/java-frequent-repaint-has-too-high-cpu-usage ... I am trying reducing the number of repaints, and it looks interesting! I am going to commit these changes, as v2.15.0, so that you (or anyone else) can play with it!
I haven't had a lot of time yet to dig into it, but I'll do some experimenting when I get a chance, to see if I can bring down the CPU without impacting responsiveness - maybe it's something simple! Cheers
I feel pretty sure this problem involves redrawing "dirty" areas - repaint() seems to be creating a "dirty" area, which immediately triggers another repaint(), resulting in a tight loop. So, yes, I am looping, but not intentionally! It would be a great help if someone - @ERnsTL or @pimgeek or anyone... - could suggest a way to find the dirty area or areas... Meanwhile, I will keep digging!
I think I have fixed this in v2.15.1. The VisualVM profiler reports CPU usage dropping from 25% to around 5%.
@ERnsTL or @pimgeek, I would appreciate it if you could so some testing...
@bobcorrick, could you do your regression testing? Thanks a million to all of you!
Just tested 2.25.1 - it is definitely an improvement.
The CPU usage seems to have shifted. DrawFBP itself is now using about 50/60 % as much as before, but now the display server is maxing out its CPU core. It seems like DrawFBP is waiting for the result of an expensive graphics operation (maybe getting dirty areas or something similar?).
In v2.14.2 it was the other way around; DrawFBP using a full core plus the display server half a core (which is also a lot).
So much for what is observable on my machine.
Thanks so much! So there is an improvement, but we're probably still getting dirty areas. . Any idea how I can find them? Is there a tool that can walk the tree of components? Or maybe I don't understand how dirty areas get created...? Thanks in advance!
Hi Paul, I'll be able to find time for this over the next few days: family matters are keeping us busy (grandchildren). Glad to see that you are still maintaining DrawFBP. I've had a break from technical work this year, so I now need to set up a laptop to get back into it for the regression testing. All the best to you and yours, Bob.
On 29 Aug 2018, at 03:00, Paul Morrison notifications@github.com<mailto:notifications@github.com> wrote:
I think I have fixed this in v2.15.1. The VisualVM profiler reports CPU usage dropping from 25% to around 5%.
@ERnsTLhttps://github.com/ERnsTL or @pimgeekhttps://github.com/pimgeek, I would appreciate it if you could so some testing...
@bobcorrickhttps://github.com/bobcorrick, could you do your regression testing? Thanks a million to all of you!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/jpaulm/drawfbp/issues/12#issuecomment-416797820, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHKwpNPSIaqun-hffoezjGEzk3Sautg7ks5uVfWfgaJpZM4N9XL5.
Hi again Paul, I now have Java set up on a Win 10 laptop, but cannot see the latest DrawFBP via the maven.orghttp://maven.org link - only the 2.14 one. I was expecting to see v 2.15.2 according to the GitHub remarks, Kind regards, Bob.
On 2 Sep 2018, at 09:39, Bob bobcorrick@outlook.com<mailto:bobcorrick@outlook.com> wrote:
Hi Paul, I'll be able to find time for this over the next few days: family matters are keeping us busy (grandchildren). Glad to see that you are still maintaining DrawFBP. I've had a break from technical work this year, so I now need to set up a laptop to get back into it for the regression testing. All the best to you and yours, Bob.
On 29 Aug 2018, at 03:00, Paul Morrison notifications@github.com<mailto:notifications@github.com> wrote:
I think I have fixed this in v2.15.1. The VisualVM profiler reports CPU usage dropping from 25% to around 5%.
@ERnsTLhttps://github.com/ERnsTL or @pimgeekhttps://github.com/pimgeek, I would appreciate it if you could so some testing...
@bobcorrickhttps://github.com/bobcorrick, could you do your regression testing? Thanks a million to all of you!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/jpaulm/drawfbp/issues/12#issuecomment-416797820, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHKwpNPSIaqun-hffoezjGEzk3Sautg7ks5uVfWfgaJpZM4N9XL5.
Sorry about the confusion! I had some stuff from 2.15.0 still on Github - I didn't realize that some assets would get left even after I deleted the release!
v2.14.2 is the last (fairly) good one, but it has this CPU usage problem... v2.15.1 tried to solve it, and improved it a bit, but still no luck! I am zeroing in on the problem, but haven't quite solved it, so v2.15.1 is only Pre-release! Hope to get a solution in the next few days! Fingers crossed!
Dumb mistake, I think, but it's been in the code for ages!!! Thanks to @ERnsTL and @pimgeek for pointing it out. Sorry, @pimgeek, that I didn't pick up on your issue a long time ago!
I think I have fixed this in v2.15.2. Task Manager now shows little blips, rather than one core running at around 90% ! The VisualVM profiler looks very different now!
@ERnsTLhttps://github.com/ERnsTL or @pimgeekhttps://github.com/pimgeek, I would appreciate it if you could so some testing...
@bobcorrickhttps://github.com/bobcorrick, could you do your regression testing, at your leisure, of course!? Thanks a million to all of you!
You can get the latest version from GitHub/DrawFBP/Releases jar file for v2.15.2.
Just tested the new 2.15.2 - CPU usage is all practically zero when no diagram loaded, when minimized, with normal window size, when network diagram opened.
This issue looks fixed to me. Thanks for hunting this down, Paul!
Hi Paul,
I just had a short test session, late in the day - now 22:45 local time.
REPORT Regression test using Windows 10 laptop, DrawFBP 2.15.2 - basic menu and drawing operations ok. There were a couple of observations: File > Display Properties did not show a property list File > Change Fonts- Text for the version number does not change when font or size is changed.
I did not exercise complex diagram creation yet, as I did not find the JavaFBP jar file: could you help me with that, please?
More soon, and kind regards to you, All the best, Bob.
On 8 Sep 2018, at 22:03, ERnsTL notifications@github.com<mailto:notifications@github.com> wrote:
Just tested the new 2.15.2 - CPU usage is all practically zero when no diagram loaded, when minimized, with normal window size, when network diagram opened.
This issue looks very fixed to me. Thanks for hunting this down, Paul!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/jpaulm/drawfbp/issues/12#issuecomment-419672655, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHKwpJeg1Ro_rCjDXlk14P78rgNloLg2ks5uZDCegaJpZM4N9XL5.
Greetings Bob, If you are looking for the released pre-compiled DrawFBP .jar file:
Many thanks, @ERnsTL, that's great news! I have marked this issue closed. Thanks again!
@bobcorrick , thanks for the testing! @ernstl's comment about finding the JavaFBP jar file is correct, but applies to the JavaFBP repository, and the latest release is v4.1.0, so the jar file can be found at https://github.com/jpaulm/javafbp/releases/tag/v4.1.0 .
Thanks for your comment about not seeing the properties list. I believe I have found the cause, and I will include this in v2.15.3.
Same thing for version number font not changing. Thx again!
By the way, @ERnsTL , you were right! It was effectively a loop: I was issuing a repaint inside a paintComponent method! I didn't realize it, but that resulted in a tight loop! Best regards, P.
Ah, just noticed that Bob was asking for the jar file for JavaFBP not DrawFBP. Ah, anyway ;-)
@jpaulm: Glad you found the issue! These event- and component-driven frameworks are are all good and nice... but getting an overview of the event flow and which component causes a repaint ... I am sure this was difficult to trace.
Thanks again for staying on it and hunting it down. Best Greetings, Ernst
Please see the following screenshot to get a basic idea, I could provide more info if necessary.
I was trying to modify a simple Network Diagram, like this:
If the CPU usage stays high like this, I may have to maintain network connections by hand. :disappointed: