Skip to content

Conversation

@dmatej
Copy link
Contributor

@dmatej dmatej commented Nov 15, 2025

New parameters

  • User has control what will be considered as the "server successfully started" state.
    • pid file
    • process state
    • any of admin ports
    • all of custom endpoints (might be useful when we can access some public endpoint and we would need to block some script until the endpoint is publicly visible; I doubt if I would ever use it, but ...)
  • printServerOutput - explicitly ask to print the process output in the report. If not set, it is printed just if the terse was not set to true and if the start failed.

Logging

  • If terse not set, all start and restart commands now print some basic info about the server
    • Can be extended later
  • When Restart Domain and Restart Local Instance now fail, they print the output of the failed start of the server. The start of the server already knows if it is restarting or just starting, so it also knows if there's some parent able to read the output. If there is no such parent, it will set the log handler and the local command then can read it.

Fixed Bugs

  • Admin endpoints can be a list, but we used just first item. At least one should be accessible.
  • Race conditions between processes
    • Not sure if I can remember well and describe them well
    • TBD, I have to read diff

@dmatej dmatej changed the title Server starts More flexibility to control server start Nov 18, 2025
@dmatej dmatej requested a review from a team November 18, 2025 00:54
@dmatej dmatej added this to the 7.1.0 milestone Nov 18, 2025
@dmatej dmatej linked an issue Nov 18, 2025 that may be closed by this pull request
- Added reporting important informations
- More useful error management
  - --terse limits the amount of printed information
- The fact that the process is alive, doesn't always mean it will be alive one
  second later. Check admin port too, by default. This will be configurable
  later.
- User can configure "definition" of the started server
- When process dies before the command, it is always an error
- Added explicit option to print the process output
- StartServerShutdownHook logging
  - it is kept, but the startup logging done by the AsadminMain is supported
    also on Windows

Signed-off-by: David Matějček <[email protected]>
- It declared the debug port free, but immediately 300 ms later it was blocked.

Signed-off-by: David Matějček <[email protected]>
Signed-off-by: David Matějček <[email protected]>
- We have issues on Windows on GHA with this.
- Maybe local restarts should be done as stop-start on Windows?
  Respawning is not recommended and on windows it seems really risky

Signed-off-by: David Matějček <[email protected]>
@dmatej dmatej marked this pull request as ready for review November 26, 2025 22:40
private AsadminResult exec(final Integer timeout, final boolean detachedAndTerse, final String... args) {
final List<String> parameters = Arrays.asList(args);
LOG.log(TRACE, "exec(timeout={0}, detached={1}, args={2})", timeout, detachedAndTerse, parameters);
LOG.log(INFO, "exec(timeout={0}, detached={1}, args={2})", timeout, detachedAndTerse, parameters);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not seeing this when I had issues on GHA was very confusing.


@PostConstruct
public void postConstruct() {
// WARN: Neither PreDestroy annotation nor interface worked!
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PreDestroy annotation doesn't work here.
PreDestrou interface doesn't work too.
This was here on 2024, in one change I removed it, I was wrong.

// Still, threads already working with the instance will have it unstable.
final ORB destroyedOrb = orb;
orb = null;
// FIXME: com.sun.corba.ee.impl.transport.AcceptorImpl.getAcceptedSocket(AcceptorImpl.java:127)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#25804 will target this.


serverSocket.bind(inetSocketAddress);
return serverSocket;
final Action<ServerSocket> action = () -> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Desperate action, I will recheck in #25804 if it helps anything. When GF + Corba will reliably close all open ports on shutdown, this should be removed.

assertThat(result, asadminOK());
public static void fillUpServerLog() throws Exception {
if (OS.isWindowsForSure()) {
// For some reason windows can collide on debug port.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't experience blocked --debug ports on Linux in restart-domain command, but GHA on Windows does it. Seems like it doesn't close debug port when one process spawns another - the new then tries to open the same port, could reuse it, which is not a good idea, but ...
I think we had this problem on Solaris many years ago too.

@@ -0,0 +1,76 @@
/*
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to use AI to generate free ports, but finally this was easier.

@arjantijms arjantijms merged commit 342086c into eclipse-ee4j:master Nov 27, 2025
6 checks passed
@dmatej dmatej added the enhancement New feature or request label Nov 27, 2025
@dmatej dmatej deleted the restarts branch November 27, 2025 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The start-domain command randomly times out

2 participants