You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2026/09/02 14:19:00 UTC

[jira] [Commented] (OFBIZ-13516) Replace flaky fixed Thread.sleep(3000) in LuceneTests with a bounded polling loop

    [ https://issues.apache.org/jira/browse/OFBIZ-13516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18110677#comment-18110677 ] 

ASF subversion and git services commented on OFBIZ-13516:
---------------------------------------------------------

Commit 807c5a019872586e7e86a10f7a3c86fb0ff941a6 in ofbiz-plugins's branch refs/heads/trunk from Mridul Pathak
[ https://gitbox.apache.org/repos/asf?p=ofbiz-plugins.git;h=807c5a019 ]

Improved: Replaced flaky fixed sleep in LuceneTests with a bounded polling loop (OFBIZ-13516)

LuceneTests.groovy slept a fixed 3 seconds after indexContentTree to let the indexer catch up before searching, but indexContentTree only enqueues documents onto a background thread's queue and returns immediately, so the wait was inherently racy (could fail under a slow/busy run) and wasteful (padded every run even when indexing finished early). Replaced the fixed sleep with a bounded polling loop that retries the search until the expected hit appears or a generous timeout elapses, verified stable across repeated local test runs.


> Replace flaky fixed Thread.sleep(3000) in LuceneTests with a bounded polling loop
> ---------------------------------------------------------------------------------
>
>                 Key: OFBIZ-13516
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-13516
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: lucene
>    Affects Versions: Upcoming Branch
>            Reporter: Mridul Pathak
>            Assignee: Mridul Pathak
>            Priority: Major
>
> LuceneTests.groovy sleeps a fixed 3 seconds after calling indexContentTree, before searching the Lucene index, to let indexing finish. indexContentTree only enqueues documents onto a background thread's queue and returns immediately — the actual IndexWriter write/commit/close happens asynchronously with no join(), future, or other hook to synchronize on. A fixed sleep is therefore both racy (can fail under slow CI/GC pauses) and wasteful (pads testIntegration runtime even when indexing finishes early), similar to fixed sleeps trunk commit 485496ad3e (PR #1805) already fixed in EntityTestSuite.java.
> Since no writer-side synchronization hook exists, replace the fixed sleep with a bounded polling loop on the reader side (retry the search on a short interval, up to a generous timeout) in LuceneTests.groovy. Verify no flakiness across repeated testIntegration runs before landing.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)