Skip to content

Fixed race condition in detached job scheduling - #25592

Merged
dmatej merged 2 commits into
eclipse-ee4j:masterfrom
dmatej:asyncjobs
Jul 13, 2025
Merged

Fixed race condition in detached job scheduling#25592
dmatej merged 2 commits into
eclipse-ee4j:masterfrom
dmatej:asyncjobs

Conversation

@dmatej

@dmatej dmatej commented Jul 3, 2025

Copy link
Copy Markdown
Contributor
  • Fixes Detached commands sometimes return results instead of id #25575
  • The consequence of refactoring is the fix
  • Fixed bad design; onAdminCommandEvent was executed asynchronously to the static invokeAsync method which caused unpredictable result when using the --detach argument.
  • I did not see it first, so I made some code cleanup before I understood what was happening.
    • Deleted unused methods
    • inlined some utility methods which were used just on a single place
    • removed sharing loggers (very confusing when you want to find what does what)
    • renamed classes and methods so now it makes more sense
    • merged AdminCommandStateImpl and AdminCommandInstanceImpl and renamed to AdminCommandJob. Deserialized "reflections" are just simple pojos now.
    • ExecutorServiceFactory was removed - now we have properly named threads.
    • Removed swallowing exceptions on several places - log or rethrow
    • Improved responsibilities
  • Most important classes
    • SseAdminCommandInvoker - responsible for the communication with the client using SSE.
    • ActionReport - must have locking to prevent overwriting messages from parallel threads.
  • I did not see the issue since this fix made on top of Migrate from JKS to PKCS12 #25529 PR

@dmatej dmatej added this to the 7.1.0 milestone Jul 3, 2025
@dmatej
dmatej requested a review from a team July 3, 2025 21:57
@dmatej dmatej self-assigned this Jul 3, 2025
@dmatej dmatej added the bug Something isn't working label Jul 3, 2025
@dmatej
dmatej force-pushed the asyncjobs branch 3 times, most recently from e7c16f2 to d7136c1 Compare July 6, 2025 13:03
@dmatej
dmatej marked this pull request as draft July 6, 2025 20:37
@dmatej
dmatej force-pushed the asyncjobs branch 2 times, most recently from 77d5fda to 84e5661 Compare July 10, 2025 23:14
@dmatej
dmatej marked this pull request as ready for review July 10, 2025 23:15
@dmatej
dmatej marked this pull request as draft July 11, 2025 06:53
@dmatej
dmatej force-pushed the asyncjobs branch 2 times, most recently from 37425fd to 36da910 Compare July 11, 2025 12:52
- Increased timeout for the first start-domain - on GH Actions Mac 30 seconds
  was not enough
- ASADMIN caused initialization of the GlassFishTestEnvironment before any
  test started which was a bit confusing, especially when it failed declaring
  that preparations to run the WINDOWS test on Mac failed.

Signed-off-by: David Matějček <david.matejcek@omnifish.ee>
@dmatej
dmatej force-pushed the asyncjobs branch 3 times, most recently from ec747ec to 69ec045 Compare July 11, 2025 23:24
@dmatej
dmatej marked this pull request as ready for review July 11, 2025 23:24
- The consequence of refactoring is the fix
- Fixed bad design; onAdminCommandEvent could be executed asynchronously to
  the static invokeAsync method which caused unpredictable result when using
  the --detach argument.
- I did not see it first, so I made some code cleanup before I understood what
  was happening.
  - Deleted unused methods
  - inlined some utility methods which were used just on a single place
  - removed sharing loggers (very confusing when you want to find something)
  - renamed classes and methods so now it makes more sense
  - merged AdminCommandStateImpl and AdminCommandInstanceImpl and renamed
    to AdminCommandJob. Deserialized "reflections" are just simple pojos now.
  - ExecutorServiceFactory was removed - now we have named threads.
  - Removed swallowing exceptions on several places - log or rethrow
  - Improved responsibilities
  - Most important players: SseAdminCommandInvoker and ActionReport

Signed-off-by: David Matějček <david.matejcek@omnifish.ee>
@dmatej
dmatej merged commit cfee9fc into eclipse-ee4j:master Jul 13, 2025
2 checks passed
@dmatej
dmatej deleted the asyncjobs branch July 13, 2025 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Detached commands sometimes return results instead of id

3 participants