You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Martin Zink (Jira)" <ji...@apache.org> on 2022/11/15 08:46:00 UTC

[jira] [Created] (MINIFICPP-1985) Use asio related tests on random ports

Martin Zink created MINIFICPP-1985:
--------------------------------------

             Summary: Use asio related tests on random ports
                 Key: MINIFICPP-1985
                 URL: https://issues.apache.org/jira/browse/MINIFICPP-1985
             Project: Apache NiFi MiNiFi C++
          Issue Type: Improvement
            Reporter: Martin Zink
            Assignee: Martin Zink


The tests in question are PutTCPTests, PutUDPTests, ListenTCPTests, ListenUDPTests.

We shouldn't use hard coded ports to run the tests on.

I've tried creating a test utility that creates a socket on port 0. (so the OS assigns a random port to it), then close the socket and return the port to bind to.

Unfortunately this could leave the port on TIME_WAIT (which could be workaround by setting reuse_address (which we may very well want to use besides this, so restarting the processor on the same port can work without hiccups), but due to race conditions sometimes the port is not even in the TIME_WAIT state when the processor wants to bind to it.

 

The proper solution would be to directly set the processor (or utility) to port 0. And get the listening port out after the socket/acceptor is already up and running, this would require a larger refactor (both tests and prod code as well), it would make sense to do this during the MINIFICPP-1979 refactor.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)