shuke987 opened a new pull request, #70526:
URL: https://github.com/apache/doris/pull/70526

   ### Background
   
   FE unit tests start a mocked frontend inside the test JVM. The catalog 
publishes its RPC port to backends during initialization, and the Thrift 
service starts later.
   
   ### What problem does this PR solve?
   
   Issue Number: None  
   Related PR: None  
   PR Type: Bugfix
   
   Both FE test fixtures used to obtain a free port by opening and closing a 
temporary socket. Another fork could bind the port before Thrift started. The 
resulting bind failure exited the entire test JVM. The mocked FE now binds an 
ephemeral listener before initializing the catalog and passes that same 
listener to the blocking Thrift server.
   
   ### Details
   
   - **Frequency:** Intermittent during parallel FE unit tests. A competing 
bind in the interval between port selection and server startup reproduces the 
failure.
   - **Root cause:** The recorded port number survived startup, but the socket 
that reserved it had already been closed.
   - **Why existing tests missed it:** They relied on the timing of a competing 
process and did not check listener identity across startup.
   - **Fix:** Publish the bound port before initializing the catalog. Both 
fixtures wait for FE service startup, read the assigned port, and use it for 
the mocked backend callback.
   - **Other paths and branches:** The default thread-pool and simple Thrift 
servers accept the existing socket. The threaded selector and providers that 
require their own transport use their existing port-based startup. Normal FE 
startup continues to use its configured port.
   
   ### Testing
   
   - Local FEUT passed all 12 tests in `ThriftServerTest` and 
`CheckRowPolicyTest`. The new transport test queues a connection before 
starting Thrift, makes a heartbeat RPC on it, and checks that shutdown releases 
the listener.
   - FE Checkstyle passed with zero violations.
   - Added `DemoTest.testAdvertisedRpcPort` to ping the FE through the callback 
port and check the port in its response. This test and the eight-fork 
integration run await CI.
   
   ### Release note
   
   None
   
   ### Check List (For Author)
   
   - Behavior changed: No user-facing change.
   - Does this need documentation: No.
   - Pre-submission status: Partially verified. The targeted tests and style 
check passed locally. Parallel FEUT awaits CI.
   
   ### AI Disclosure
   
   - Tool: OpenAI Codex (GPT-6).
   - Generated: Implementation, tests, and PR description.
   - Human review: Pending.
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to