Opened 7 years ago
Closed 7 years ago
#2818 closed defect (done)
GUI is unresponsive if multiple displayed algorithms are running
Reported by: | mkommend | Owned by: | mkommend |
---|---|---|---|
Priority: | highest | Milestone: | HeuristicLab 3.3.15 |
Component: | Optimization.Views | Version: | 3.3.14 |
Keywords: | Cc: |
Description (last modified by mkommend)
If multiple algorithms are displayed next to each other (tabs side by side) and running the HL GUI slows down and becomes unresponsive. This becomes so severe that HL cannot be closed anymore, but must be terminated.
The attached file illustrates the bug by opening two fast running algorithms (GA - TSP Popsize 10), showing them side by side and starting both asynchronously.
A possible explanation is that the event queue displaying the GUI is filled two fast (ToStringChanged events) and cannot catch upl anymore.
Attachments (1)
Change History (10)
Changed 7 years ago by mkommend
comment:1 Changed 7 years ago by mkommend
- Description modified (diff)
comment:2 Changed 7 years ago by mkommend
PFleck discovered that manual calls to Application.DoEvents resolve the issue. However, the use of Application.DoEvents should be avoided if possible (MSDN,Stackoverflow).
If the following code is added to the ResultCollection the GUI stays responsive and the problem does not occur anymore. However, this is not extensively tested and possible side-effects are unknown.
protected override void Item_ToStringChanged(object sender, EventArgs e) { if (InvokeRequired) { Invoke(new EventHandler(Item_ToStringChanged), sender, e); return; } base.Item_ToStringChanged(sender, e); System.Windows.Forms.Application.DoEvents(); }
comment:3 Changed 7 years ago by mkommend
- Owner changed from architects to mkommend
- Status changed from new to accepted
comment:4 Changed 7 years ago by mkommend
- Owner changed from mkommend to architects
- Status changed from accepted to reviewing
r15312: Added call to Application.DoEvents in ResultCollectionView.Item_ToStringChanged to avoid congestion of the event queue.
This has been discussed with swagner, gkronber, and abeham. Additionally, the performance impact has been profiled and the performance is only slightly affected when results are actually displayed (GA-TSP sample).
comment:5 Changed 7 years ago by mkommend
- Owner changed from architects to abeham
comment:6 Changed 7 years ago by abeham
- Owner changed from abeham to mkommend
- Status changed from reviewing to readytorelease
Reviewed: OK
comment:7 Changed 7 years ago by gkronber
Not sure if this is related but I ran into what seems to be a GUI deadlock today while I was downloading Jobs from the Hive Server (multiple downloads concurrently).
The threads stopped in the following methods:
HeuristicLab.Clients.Hive.JobManager.Views.RefreshableHiveJobView.OnContentChangedHeuristicLab.MainForm.WindowsForms.AsynchronousContentView.InvokeSystem.Windows.Forms.Control.WaitForWaitHandle
The GUI froze but execution of algorithms in the background was not affected.
EDIT: The code in RefreshableHiveJobView contains a lock() statement. The code in OptimizerHiveTask contains operations with ReaderWriterLocks. I guess the observed behavior is more likely caused by a bug in those classes and not related to this ticket.
comment:8 Changed 7 years ago by mkommend
comment:9 Changed 7 years ago by mkommend
- Resolution set to done
- Status changed from readytorelease to closed
Added sample script that freezes the GUI