Skip to content

Commit c53379b

Browse files
Fix AST-137779: Move getScansForProject off the UI thread on scan completion
DataProvider.getScansForProject() invokes a blocking CLI subprocess (CxWrapper.scanList -> Execution.executeCommand -> readLine). Calling it inside syncExec blocked the UI thread for ~1.9s and caused a deadlock where pool-9-thread-1 waited on the UI thread that was stuck in I/O. Fix: read the branch combo text with a minimal syncExec (widget read only, no I/O), then call getScansForProject on the background pollingScan thread, then update the combo and show the notification in a second syncExec that contains no blocking calls. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent 5bfa931 commit c53379b

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

checkmarx-ast-eclipse-plugin/src/com/checkmarx/eclipse/views/actions/ActionStartScan.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -334,19 +334,24 @@ private Runnable pollingScan(String scanId) {
334334
startScanAction.setEnabled(true);
335335

336336
if (scan.getStatus().toLowerCase(Locale.ROOT).equals(PluginConstants.CX_SCAN_COMPLETED_STATUS)) {
337+
// Read branch text on UI thread (fast widget access only).
338+
final String[] branchHolder = new String[1];
339+
Display.getDefault().syncExec(() -> branchHolder[0] = branchesCombo.getCombo().getText());
340+
341+
// Fetch scan list on the background thread so the UI is never blocked.
342+
List<Scan> scanList = DataProvider.getInstance().getScansForProject(branchHolder[0]);
343+
344+
// Update UI and show notification on the UI thread (no blocking I/O here).
337345
Display.getDefault().syncExec(new Runnable() {
338346
AbstractNotificationPopup notification;
339347

340348
@Override
341349
public void run() {
342-
// Refresh the scan list and mark the new scan as latest —
343-
// but do NOT auto-load results or change the current view.
344-
List<Scan> scanList = DataProvider.getInstance().getScansForProject(branchesCombo.getCombo().getText());
345350
GlobalSettings.storeInPreferences("LATEST_SCAN_ID", scanId);
346351
scansCombo.setInput(scanList);
347352

348-
// Show notification. Results only load when the user explicitly
349-
// clicks "Load Results"; closing/ignoring leaves the current view intact.
353+
// Results only load when the user explicitly clicks "Load Results".
354+
// Closing or ignoring the notification leaves the current view intact.
350355
notification = new NotificationPopUpUI(Display.getCurrent(),
351356
PluginConstants.CX_SCAN_FINISHED_TITLE,
352357
PluginConstants.CX_SCAN_FINISHED_DESCRIPTION, null,

0 commit comments

Comments
 (0)