jbonofre opened a new pull request, #3103:
URL: https://github.com/apache/karaf/pull/3103
## Problem
`EventLoggerTest.testUdp` fails now and then, for instance on macos-latest
in the CI of #3009 (run 43734862400):
```
java.net.BindException: Address already in use
at java.base/java.net.DatagramSocket.<init>(DatagramSocket.java:355)
at
org.apache.karaf.audit.logger.EventLoggerTest.testUdp(EventLoggerTest.java:72)
```
The test job then stops at `audit`, before the itests.
## Root cause
`getNewPort()` asks a TCP `ServerSocket` for a free port, and `testUdp`
binds a `DatagramSocket` on it. TCP and UDP ports are separate: a port free for
TCP may be in use for UDP. With a UDP socket held on a port, a `ServerSocket`
binds the same port, and a `DatagramSocket` on it fails with "Address already
in use".
## Fix
`testUdp` binds its `DatagramSocket` on an ephemeral UDP port, and gives its
port to the `UdpEventLogger`. `getNewPort()` is still used by `testTcp`, for a
TCP port.
--
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]