Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reserve_network_port no lock multiple instance builds #218

Open
xiaoyao9184 opened this issue Aug 25, 2024 · 0 comments
Open

reserve_network_port no lock multiple instance builds #218

xiaoyao9184 opened this issue Aug 25, 2024 · 0 comments

Comments

@xiaoyao9184
Copy link

When multiple Maven instances are running at the same time, for example, when using git flow finish release, CI will build branches and tags at the same time. The two executions will use the same minPortNumber and maxPortNumber configurations to find ports. At this time, there is a high probability that the same port will be found, but in the end only one instance can be listened to, and the other will fail. Is there a similar locking mechanism to ensure that multiple instances across processes obtain exclusive port usage rights, or can I only introduce a retry mechanism to run the entire Maven instance?

The following is an extreme example, where 2 out of 3 ports are found. If two Maven instances are run at the same time, one of the ports will inevitably be found by both.

<execution>
    <id>reserve-tomcat-port</id>
    <goals>
	    <goal>reserve-network-port</goal>
    </goals>
    <phase>process-resources</phase>
    <configuration>
	    <maxPortNumber>38773</maxPortNumber>
	    <minPortNumber>38771</minPortNumber>
	    <randomPort>true</randomPort>
	    <portNames>
		    <portName>random.jmx.port</portName>
		    <portName>tomcat.http.port</portName>
	    </portNames>
    </configuration>
</execution>
[INFO]
[INFO] --- build-helper-maven-plugin:3.6.0:reserve-network-port (reserve-tomcat-port) @ test-boot ---
[INFO] Port assigned 38773
[INFO] Reserved port 38773 for random.jmx.port
[INFO] Port assigned 38771
[INFO] Reserved port 38771 for tomcat.http.port
[INFO]
[INFO] --- build-helper-maven-plugin:3.6.0:reserve-network-port (reserve-tomcat-port) @ test-boot ---
[INFO] Port assigned 38772
[INFO] Reserved port 38772 for random.jmx.port
[INFO] Port assigned 38771
[INFO] Reserved port 38771 for tomcat.http.port
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant