From 97ca574116bb5ee5af0bf1ed69fe1f60b6b770b6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 31 Mar 2026 14:32:44 +0000 Subject: [PATCH 01/12] Initial plan From bbc3d1165a3565cbcd998c8bfc1673c645ae390b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 31 Mar 2026 14:34:39 +0000 Subject: [PATCH 02/12] ci: add Windows service start/stop test to Test on Windows step Agent-Logs-Url: https://github.com/OpenIdentityPlatform/OpenDJ/sessions/b8d7e4b7-e6e7-45c5-b70c-b90833a88d84 Co-authored-by: vharseko <6818498+vharseko@users.noreply.github.com> --- .github/workflows/build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 26894a3684..a4131e4327 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -234,6 +234,12 @@ jobs: opendj-server-legacy\target\package\opendj\bat\rebuild-index.bat --bindDN "cn=Directory Manager" --bindPassword password --baseDN "dc=example2,dc=com" --rebuildAll --trustAll opendj-server-legacy\target\package\opendj\bat\ldapsearch.bat --hostname localhost --port 1636 --bindDN "cn=Directory Manager" --bindPassword password --useSsl --trustAll --baseDN "dc=example2,dc=com" --searchScope sub "(uid=user.*)" dn | find /c '"dn:"' | findstr "10000" opendj-server-legacy\target\package\opendj\bat\stop-ds.bat + opendj-server-legacy\target\package\opendj\bat\windows-service.bat --enableService + net start OpenDJ + powershell -Command "for ($i=0; $i -lt 12; $i++) { try { $c = New-Object System.Net.Sockets.TcpClient('localhost', 1636); $c.Close(); break } catch { Start-Sleep -Seconds 5 } }" + opendj-server-legacy\target\package\opendj\bat\status.bat --bindDN "cn=Directory Manager" --bindPassword password + net stop OpenDJ + opendj-server-legacy\target\package\opendj\bat\windows-service.bat --disableService - name: Upload artifacts OpenDJ Server uses: actions/upload-artifact@v4 with: From 607c63167ebd4fcfcb522a709c6dbec17a6724c2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 31 Mar 2026 15:31:01 +0000 Subject: [PATCH 03/12] fix: correct Windows service name and PowerShell wait loop in CI Agent-Logs-Url: https://github.com/OpenIdentityPlatform/OpenDJ/sessions/a07e721d-23f2-4511-976c-3682f3473369 Co-authored-by: vharseko <6818498+vharseko@users.noreply.github.com> --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a4131e4327..cc2c4e9ed0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -235,10 +235,10 @@ jobs: opendj-server-legacy\target\package\opendj\bat\ldapsearch.bat --hostname localhost --port 1636 --bindDN "cn=Directory Manager" --bindPassword password --useSsl --trustAll --baseDN "dc=example2,dc=com" --searchScope sub "(uid=user.*)" dn | find /c '"dn:"' | findstr "10000" opendj-server-legacy\target\package\opendj\bat\stop-ds.bat opendj-server-legacy\target\package\opendj\bat\windows-service.bat --enableService - net start OpenDJ - powershell -Command "for ($i=0; $i -lt 12; $i++) { try { $c = New-Object System.Net.Sockets.TcpClient('localhost', 1636); $c.Close(); break } catch { Start-Sleep -Seconds 5 } }" + net start "OpenDJ Server" + for ($i=0; $i -lt 12; $i++) { try { $c = New-Object System.Net.Sockets.TcpClient('localhost', 1636); $c.Close(); break } catch { Start-Sleep -Seconds 5 } } opendj-server-legacy\target\package\opendj\bat\status.bat --bindDN "cn=Directory Manager" --bindPassword password - net stop OpenDJ + net stop "OpenDJ Server" opendj-server-legacy\target\package\opendj\bat\windows-service.bat --disableService - name: Upload artifacts OpenDJ Server uses: actions/upload-artifact@v4 From 7b70095de59250f585b7c9d83459ec4cb2ca8b4a Mon Sep 17 00:00:00 2001 From: Valery Kharseko Date: Tue, 31 Mar 2026 18:34:41 +0300 Subject: [PATCH 04/12] Replace status.bat with ldapsearch.bat in build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cc2c4e9ed0..af65065eaf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -237,7 +237,7 @@ jobs: opendj-server-legacy\target\package\opendj\bat\windows-service.bat --enableService net start "OpenDJ Server" for ($i=0; $i -lt 12; $i++) { try { $c = New-Object System.Net.Sockets.TcpClient('localhost', 1636); $c.Close(); break } catch { Start-Sleep -Seconds 5 } } - opendj-server-legacy\target\package\opendj\bat\status.bat --bindDN "cn=Directory Manager" --bindPassword password + opendj-server-legacy\target\package\opendj\bat\ldapsearch.bat --hostname localhost --port 1636 --bindDN "cn=Directory Manager" --bindPassword password --useSsl --trustAll --baseDN "dc=example2,dc=com" --searchScope sub "(uid=user.*)" dn | find /c '"dn:"' | findstr "10000" net stop "OpenDJ Server" opendj-server-legacy\target\package\opendj\bat\windows-service.bat --disableService - name: Upload artifacts OpenDJ Server From 8416aeaa94cd09aac2c695c77447ce7fdd49ca2a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 31 Mar 2026 15:43:41 +0000 Subject: [PATCH 05/12] Initial plan From 2c785d19a76dd37c54da0e9dae35a6cbe558c0e9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 31 Mar 2026 16:46:42 +0000 Subject: [PATCH 06/12] Initial plan From 00a8ec68f3756b45fdedca6f59130c3390fadca4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 31 Mar 2026 17:08:32 +0000 Subject: [PATCH 07/12] fix: add retry loop in doStartApplication createOk&&waitOk branch to fix Windows Service startup race condition (#259) Agent-Logs-Url: https://github.com/OpenIdentityPlatform/OpenDJ/sessions/bda703f7-83cc-4cf1-816a-65b26d4b8917 Co-authored-by: vharseko <6818498+vharseko@users.noreply.github.com> --- .../src/build-tools/windows/service.c | 44 ++++++++++++++++--- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/opendj-server-legacy/src/build-tools/windows/service.c b/opendj-server-legacy/src/build-tools/windows/service.c index 0f9f6e0fc0..38206787c5 100644 --- a/opendj-server-legacy/src/build-tools/windows/service.c +++ b/opendj-server-legacy/src/build-tools/windows/service.c @@ -563,12 +563,44 @@ ServiceReturnCode doStartApplication() if (createOk && waitOk) { - BOOL running; - // Just check once if the server is running or not: since the wait - // wait was successful, if the server is getting the lock, it already - // got it. - isServerRunning(&running, TRUE); - if (running) + // The batch file process completed successfully, but the Java server + // process may not have acquired the lock file yet (especially on + // Windows 11 where JVM startup can be slower). Retry with a loop + // similar to the else-if branch below. + // See: https://github.com/OpenIdentityPlatform/OpenDJ/issues/259 + const DWORD DEFAULT_TRIES = 100; + int nTries = DEFAULT_TRIES; + char * nTriesEnv = getenv("OPENDJ_WINDOWS_SERVICE_START_NTRIES"); + BOOL running = FALSE; + if (nTriesEnv != NULL) + { + debug("OPENDJ_WINDOWS_SERVICE_START_NTRIES env var set to %s", nTriesEnv); + nTries = (int)strtol(nTriesEnv, (char **)NULL, 10); + if (nTries <= 0) + { + nTries = DEFAULT_TRIES; + } + } + else + { + debug("OPENDJ_WINDOWS_SERVICE_START_NTRIES is not set. Using default %d tries.", nTries); + } + + while ((nTries > 0) && !running) + { + nTries--; + if (isServerRunning(&running, TRUE) != SERVICE_RETURN_OK) + { + break; + } + if (!running) + { + debug("Sleeping for 5 seconds to allow the process to get the lock. %d tries remaining.", + nTries); + Sleep(5000); + } + } + if (running) { returnValue = SERVICE_RETURN_OK; debug("doStartApplication: server running."); From 9cad63cadc978564ba221118c59c92a0faa9989b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 31 Mar 2026 18:20:01 +0000 Subject: [PATCH 08/12] chore: add Portions Copyright 2026 3A Systems LLC to service.c Agent-Logs-Url: https://github.com/OpenIdentityPlatform/OpenDJ/sessions/5f9bd204-2761-4f54-97e1-b16d021b5fe0 Co-authored-by: vharseko <6818498+vharseko@users.noreply.github.com> --- opendj-server-legacy/src/build-tools/windows/service.c | 1 + 1 file changed, 1 insertion(+) diff --git a/opendj-server-legacy/src/build-tools/windows/service.c b/opendj-server-legacy/src/build-tools/windows/service.c index 38206787c5..42082bc2e3 100644 --- a/opendj-server-legacy/src/build-tools/windows/service.c +++ b/opendj-server-legacy/src/build-tools/windows/service.c @@ -13,6 +13,7 @@ * * Copyright 2008-2010 Sun Microsystems, Inc. * Portions Copyright 2011-2013 ForgeRock AS. + * Portions Copyright 2026 3A Systems, LLC. */ #include "service.h" From f824443f165cdaba87244be4dd5fd68987efda70 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 31 Mar 2026 19:20:13 +0000 Subject: [PATCH 09/12] Add Windows native executables build and upload steps to CI workflow Agent-Logs-Url: https://github.com/OpenIdentityPlatform/OpenDJ/sessions/9c943d96-6413-42b0-9380-3e3e6186a45d Co-authored-by: vharseko <6818498+vharseko@users.noreply.github.com> --- .github/workflows/build.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 26894a3684..886153d511 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -234,6 +234,23 @@ jobs: opendj-server-legacy\target\package\opendj\bat\rebuild-index.bat --bindDN "cn=Directory Manager" --bindPassword password --baseDN "dc=example2,dc=com" --rebuildAll --trustAll opendj-server-legacy\target\package\opendj\bat\ldapsearch.bat --hostname localhost --port 1636 --bindDN "cn=Directory Manager" --bindPassword password --useSsl --trustAll --baseDN "dc=example2,dc=com" --searchScope sub "(uid=user.*)" dn | find /c '"dn:"' | findstr "10000" opendj-server-legacy\target\package\opendj\bat\stop-ds.bat + + - name: Build Windows native executables + if: runner.os == 'Windows' + shell: cmd + run: | + call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86 + cd opendj-server-legacy\src\build-tools\windows + nmake all + + - name: Upload Windows exe artifacts + if: runner.os == 'Windows' + uses: actions/upload-artifact@v4 + with: + name: windows-exe-${{ matrix.java }} + retention-days: 5 + path: opendj-server-legacy/src/build-tools/windows/*.exe + - name: Upload artifacts OpenDJ Server uses: actions/upload-artifact@v4 with: From 8ef1b1acff1423a45e8f42dd7f3cf7fdf6b01852 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 1 Apr 2026 06:06:11 +0000 Subject: [PATCH 10/12] Move Windows native build before Maven and copy exes to lib Agent-Logs-Url: https://github.com/OpenIdentityPlatform/OpenDJ/sessions/7a28df62-1005-4859-8e60-7f15511a9a5d Co-authored-by: vharseko <6818498+vharseko@users.noreply.github.com> --- .github/workflows/build.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 886153d511..017d78dc72 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,6 +47,15 @@ jobs: if: runner.os != 'Windows' run: | echo "MAVEN_PROFILE_FLAG=-P precommit" >> $GITHUB_OUTPUT + - name: Build Windows native executables + if: runner.os == 'Windows' + shell: cmd + run: | + call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86 + cd opendj-server-legacy\src\build-tools\windows + nmake all + xcopy /Y *.exe ..\..\..\lib\ + - name: Build with Maven timeout-minutes: 180 env: @@ -235,14 +244,6 @@ jobs: opendj-server-legacy\target\package\opendj\bat\ldapsearch.bat --hostname localhost --port 1636 --bindDN "cn=Directory Manager" --bindPassword password --useSsl --trustAll --baseDN "dc=example2,dc=com" --searchScope sub "(uid=user.*)" dn | find /c '"dn:"' | findstr "10000" opendj-server-legacy\target\package\opendj\bat\stop-ds.bat - - name: Build Windows native executables - if: runner.os == 'Windows' - shell: cmd - run: | - call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86 - cd opendj-server-legacy\src\build-tools\windows - nmake all - - name: Upload Windows exe artifacts if: runner.os == 'Windows' uses: actions/upload-artifact@v4 From d23a1de9b396c94894a2cfb9ecfecc0649ee0e57 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 1 Apr 2026 06:09:34 +0000 Subject: [PATCH 11/12] Move Build Windows native executables before Set Integration Test Environment Agent-Logs-Url: https://github.com/OpenIdentityPlatform/OpenDJ/sessions/7fb02264-b78f-4248-bd9c-6e74b2f3270d Co-authored-by: vharseko <6818498+vharseko@users.noreply.github.com> --- .github/workflows/build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 017d78dc72..e95b2cd7b7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,11 +42,6 @@ jobs: path: ~/.m2/repository key: ${{ runner.os }}-m2-repository-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ runner.os }}-m2-repository - - name: Set Integration Test Environment - id: failsafe - if: runner.os != 'Windows' - run: | - echo "MAVEN_PROFILE_FLAG=-P precommit" >> $GITHUB_OUTPUT - name: Build Windows native executables if: runner.os == 'Windows' shell: cmd @@ -55,6 +50,11 @@ jobs: cd opendj-server-legacy\src\build-tools\windows nmake all xcopy /Y *.exe ..\..\..\lib\ + - name: Set Integration Test Environment + id: failsafe + if: runner.os != 'Windows' + run: | + echo "MAVEN_PROFILE_FLAG=-P precommit" >> $GITHUB_OUTPUT - name: Build with Maven timeout-minutes: 180 From dd54e58dc3023f3d64d910822ae532ef95166bd3 Mon Sep 17 00:00:00 2001 From: Valery Kharseko Date: Wed, 1 Apr 2026 10:56:15 +0300 Subject: [PATCH 12/12] Add git status command in build.yml Added git status command to the build process. --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9a5b522670..9123cd54d3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,6 +50,7 @@ jobs: cd opendj-server-legacy\src\build-tools\windows nmake all xcopy /Y *.exe ..\..\..\lib\ + git status - name: Set Integration Test Environment id: failsafe if: runner.os != 'Windows'