I think it’s related to how the kqueue works in combination with the socket
shutdown cycle in SocketChannel.

It’s likely that our close event is triggering too early.

On Thu, Jul 28, 2022 at 9:31 AM Christoph John
<[email protected]> wrote:

> Hi,
>
> we have a test suite for QuickFIX/J which runs (at least) every day.
> Sometimes I can observe that
> there are BindExceptions because a port is already in use. Context: we
> stop and start an acceptor in
> quick succession and it is expected that the port is already available
> again when the acceptor
> starts the second time. To clean up all sessions and unbind we use the
> following code:
>
>
> https://github.com/quickfix-j/quickfixj/blob/de63b0c1c4d41bf1b6ce1add5305890b81e1ad51/quickfixj-core/src/main/java/quickfix/mina/SessionConnector.java#L445-L471
>
> IMHO this should be enough to free the port, however especially (or as I
> recall only) on MacOS the
> BindException occurs every once in a while.
>
> Question: I think this is some kind of race condition or glitch on MacOS.
> So it should be safe to
> ignore it I guess?
> Is there something I can do in the code to make sure that the port is
> really unbound?
>
> Thanks
> Chris
>
> --
> Christoph John
> Software Engineering
> T +49 241 557080-28
> [email protected]
>
> MACD GmbH
> Oppenhoffallee 103
> 52066 Aachen, Germany
> www.macd.com
>
> Amtsgericht Aachen: HRB 8151
> Ust.-Id: DE 813021663
> Geschäftsführer: George Macdonald
>

Reply via email to