codeconsole commented on PR #16192:
URL: https://github.com/apache/grails-core/pull/16192#issuecomment-5381581587

   Both taken, thank you - and the `serverStatus.pid` comparison is a better 
test than anything I would have written for it.
   
   Applied as c66bf783 and db582407, authored to you, with three adaptations, 
because the code moved under your commit while it sat here:
   
   **`restart()`** now tears down through `stop()` rather than inlining the 
close. A review this morning found that `stop()` cleared its field *before* the 
close, so a close that threw left a running mongod this object reported as 
stopped - nothing would stop it and a restart would try to bind the port it 
still held. That is fixed (4ec3de68), and having one teardown path means the 
fix applies to your restart too. The initiation cleanup added in 3cf4596c also 
stays, so a set that fails to form on a restart leaves no process behind either.
   
   **`freePort()`** - the dead `reuseAddress` line was already gone in 
33d45408; your retry is what actually covers the race, so the javadoc now says 
`START_ATTEMPTS` covers it rather than my earlier line admitting it could not 
be closed.
   
   **The failed attempt** stops whatever it started rather than calling 
`context.close()`. Same audit found that closing a context that was never 
refreshed does nothing at all - `doClose()` is gated on `active`, which only 
`prepareRefresh()` sets - which is why `cleanupSpec` was leaking a live mongod 
per specification per fork. Your retry path had inherited the same no-op.
   
   `:grails-data-mongodb-embedded:check` and the transaction specs: 61 tests, 0 
failures, including *a running server is replaced by a restart rather than 
fought with for its port*.
   
   One note on your first point, since you reasoned it was unreachable through 
the lifecycle bean: it is reachable now. The initializer restarts a reused 
server itself (c0810cbb) rather than leaving it to the bean, because a 
datastore builds its indexes while beans are still being constructed, and the 
bean is not started until after refresh - so a devtools reload was failing on a 
url naming a server nothing was listening on.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to