opensearch-project / opensearch-plugin-template-java

Template repo for creating OpenSearch plugins
Apache License 2.0
24 stars 28 forks source link

[BUG] First run of project generate Execution failed for task ':integTest'. > process was found dead while waiting for ports files, node{::integTest-0} #52

Closed Javaluca closed 5 months ago

Javaluca commented 1 year ago

What is the bug?

I want to create a custom plugin for opensearch. I have simply cloned the repository and run the check task. The gradle build give me the following error.

Execution failed for task ':integTest'.
> process was found dead while waiting for ports files, node{::integTest-0}

but I don't know what it means. I haven't found anything usefull into the various discussions in this repository and in the docs provided.

How can one reproduce the bug?

Clone the repository (the last commit in the moment I'm writing is 5b0a14f47b4a1f643ec82b693937c80b478f6d93) and simply run check task with gradle wrapper ./gradlew check

What is the expected behavior?

Complete the task without errors (I think)

What is your host/environment?

Working Directory: C:\Users\OP\Documents\projects\opensearch-plugin-template-java
Gradle user home: C:\Users\OP\.gradle
Gradle Distribution: Gradle wrapper from target build
Gradle Version: 7.6
Java Home: C:\Program Files\Eclipse Adoptium\jdk-17.0.6.10-hotspot
JVM Arguments: None
Program Arguments: None
Build Scans Enabled: false
Offline Mode Enabled: false
Gradle Tasks: check

=======================================
OpenSearch Build Hamster says Hello!
  Gradle Version        : 7.6
  OS Info               : Windows 11 10.0 (amd64)
  JDK Version           : 17 (Eclipse Temurin JDK)
  JAVA_HOME             : C:\Program Files\Eclipse Adoptium\jdk-17.0.6.10-hotspot
  Random Testing Seed   : 8020D713C99B1E20
  In FIPS 140 mode      : false
=======================================

Do you have any screenshots?

I can paste the complete console messages (localized in italian)

> Task :compileJava
> Task :processResources NO-SOURCE
> Task :classes

> Task :compileTestJava
Note: C:\Users\OP\Documents\projects\opensearch-plugin-template-java\src\test\java\org\opensearch\path\to\plugin\RenamePluginIT.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

> Task :copyPluginPropertiesTemplate UP-TO-DATE
> Task :pluginProperties UP-TO-DATE
> Task :copyYamlTestsTask NO-SOURCE
> Task :copyRestApiSpecsTask UP-TO-DATE
> Task :processTestResources NO-SOURCE
> Task :testClasses
> Task :forbiddenApisResources UP-TO-DATE
> Task :forbiddenApisMain
> Task :forbiddenApisTest
> Task :compileYamlRestTestJava
> Task :processYamlRestTestResources
> Task :yamlRestTestClasses
> Task :forbiddenApisYamlRestTest UP-TO-DATE
> Task :forbiddenApis
> Task :jar
> Task :dependencyLicenses UP-TO-DATE
> Task :filepermissions UP-TO-DATE
> Task :forbiddenPatterns UP-TO-DATE
> Task :jarHell UP-TO-DATE
> Task :licenseHeaders UP-TO-DATE
> Task :loggerUsageCheck SKIPPED
> Task :testingConventions UP-TO-DATE
> Task :thirdPartyAuditResources UP-TO-DATE
> Task :thirdPartyAudit NO-SOURCE
> Task :generatePomFileForNebulaPublication
> Task :validateNebulaPom SKIPPED
> Task :generatePomFileForPluginZipPublication
> Task :validatePluginZipPom UP-TO-DATE
> Task :validatePom UP-TO-DATE
> Task :precommit
> Task :generateNotice UP-TO-DATE
> Task :bundlePlugin

> Task :integTest FAILED

=== Standard output of node `node{::integTest-0}` ===
»   ? last 40 non error or warning messages from C:\Users\OP\Documents\projects\opensearch-plugin-template-java\build\testclusters\integTest-0\logs\opensearch.stdout.log ?
» [2023-03-14T16:23:16.786917100Z] [BUILD] Configuring custom cluster specific distro directory: C:\Users\OP\Documents\projects\opensearch-plugin-template-java\build\testclusters\integTest-0\distro\3.0.0-INTEG_TEST
» [2023-03-14T16:23:16.908922Z] [BUILD] Copying additional config files from distro [C:\Users\OP\Documents\projects\opensearch-plugin-template-java\build\testclusters\integTest-0\distro\3.0.0-INTEG_TEST\config\jvm.options, C:\Users\OP\Documents\projects\opensearch-plugin-template-java\build\testclusters\integTest-0\distro\3.0.0-INTEG_TEST\config\jvm.options.d, C:\Users\OP\Documents\projects\opensearch-plugin-template-java\build\testclusters\integTest-0\distro\3.0.0-INTEG_TEST\config\log4j2.properties, C:\Users\OP\Documents\projects\opensearch-plugin-template-java\build\testclusters\integTest-0\distro\3.0.0-INTEG_TEST\config\opensearch.yml]
» [2023-03-14T16:23:16.940917700Z] [BUILD] installing 1 plugins in a single transaction
» [2023-03-14T16:23:21.443464100Z] [BUILD] installed plugins
» [2023-03-14T16:23:21.448467400Z] [BUILD] Creating opensearch keystore with password set to []
» [2023-03-14T16:23:22.519824200Z] [BUILD] Installing 0modules
» [2023-03-14T16:23:22.523824400Z] [BUILD] Starting OpenSearch process
» [2023-03-14T16:23:25.108421600Z] [BUILD] Stopping node

=== Standard error of node `node{::integTest-0}` ===
»   ? last 40 non error or warning messages from C:\Users\OP\Documents\projects\opensearch-plugin-template-java\build\testclusters\integTest-0\logs\opensearch.stderr.log ?
» "warning: no-jdk distributions that do not bundle a JDK are deprecated and will be removed in a future release" 
»  "warning: no-jdk distributions that do not bundle a JDK are deprecated and will be removed in a future release" 
»  Errore: impossibile trovare o caricare la classe principale OP\Documents\projects\opensearch-plugin-template-java\build\testclusters\integTest-0\tmp
»  Causato da: java.lang.ClassNotFoundException: OP\Documents\projects\opensearch-plugin-template-java\build\testclusters\integTest-0\tmp

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':integTest'.
> process was found dead while waiting for ports files, node{::integTest-0}

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 32s
25 actionable tasks: 11 executed, 14 up-to-date

Do you have any additional context?

I don't know if it's a bug or maybe some configurations are needed, and sorry if I'm not very clear but I'm a newbie into opensearch and gradle as well. Of course if you need additional information about the issue I will respond as soon as possible.

Thank's in advance for your help.

Javaluca commented 1 year ago

After long test, the problem seems to be related to windows machine. I've tried on a linux one and the test cluster starts correctly. Can anybody confirm this?

Unfortunately the restClient created by the framework code that perform the simple request fail

final RestClient restClient = createRestClient();
Response response = restClient.performRequest(new Request("GET", "/_cat/plugins"));

with the following error

[2023-03-17T02:54:34,201][WARN ][o.o.c.NodeConnectionsService] [node_s1] failed to connect to {node_s0}{DgW_FcS3R5yLEHlmYKaekw}{1WaXpXAKS2mNOIlNbKwdjA}{127.0.0.1}{127.0.0.1:45489}{imr}{shard_indexing_pressure_enabled=true} (tried [1] times)
org.opensearch.transport.ConnectTransportException: [node_s0][127.0.0.1:45489] connect_exception
    at org.opensearch.transport.TcpTransport$ChannelsConnectedListener.onFailure(TcpTransport.java:1076) ~[opensearch-2.3.0-SNAPSHOT.jar:2.3.0-SNAPSHOT]
    at org.opensearch.action.ActionListener.lambda$toBiConsumer$2(ActionListener.java:215) ~[opensearch-2.3.0-SNAPSHOT.jar:2.3.0-SNAPSHOT]
    at org.opensearch.common.concurrent.CompletableContext.lambda$addListener$0(CompletableContext.java:55) ~[opensearch-core-2.3.0-SNAPSHOT.jar:2.3.0-SNAPSHOT]
    at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863) ~[?:?]
    at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841) ~[?:?]
    at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?]
    at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2162) ~[?:?]
    at org.opensearch.common.concurrent.CompletableContext.completeExceptionally(CompletableContext.java:70) ~[opensearch-core-2.3.0-SNAPSHOT.jar:2.3.0-SNAPSHOT]
    at org.opensearch.nio.SocketChannelContext.connect(SocketChannelContext.java:160) ~[opensearch-nio-2.3.0-SNAPSHOT.jar:2.3.0-SNAPSHOT]
    at org.opensearch.nio.EventHandler.handleConnect(EventHandler.java:130) ~[opensearch-nio-2.3.0-SNAPSHOT.jar:2.3.0-SNAPSHOT]
    at org.opensearch.transport.nio.TestEventHandler.handleConnect(TestEventHandler.java:139) ~[framework-2.3.0-SNAPSHOT.jar:2.3.0-SNAPSHOT]
    at org.opensearch.nio.NioSelector.attemptConnect(NioSelector.java:446) ~[opensearch-nio-2.3.0-SNAPSHOT.jar:2.3.0-SNAPSHOT]
    at org.opensearch.nio.NioSelector.registerChannel(NioSelector.java:469) ~[opensearch-nio-2.3.0-SNAPSHOT.jar:2.3.0-SNAPSHOT]
    at org.opensearch.nio.NioSelector.setUpNewChannels(NioSelector.java:458) ~[opensearch-nio-2.3.0-SNAPSHOT.jar:2.3.0-SNAPSHOT]
    at org.opensearch.nio.NioSelector.preSelect(NioSelector.java:279) ~[opensearch-nio-2.3.0-SNAPSHOT.jar:2.3.0-SNAPSHOT]
    at org.opensearch.nio.NioSelector.singleLoop(NioSelector.java:172) ~[opensearch-nio-2.3.0-SNAPSHOT.jar:2.3.0-SNAPSHOT]
    at org.opensearch.nio.NioSelector.runLoop(NioSelector.java:148) ~[opensearch-nio-2.3.0-SNAPSHOT.jar:2.3.0-SNAPSHOT]
    at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.net.ConnectException: Connection refused

If I start the project with ./gradlew run the cluster start correctly and If I manually perform the command curl -XGET 'localhost:9200/_cat/plugins' it works fine giving me the list of the installed plugin.

Any idea on how to solve this? There are other way to work on custom plugin?

reta commented 1 year ago

After long test, the problem seems to be related to windows machine. I've tried on a linux one and the test cluster starts correctly. Can anybody confirm this?

I cannot reproduce it on Windows box, the check passes:

$ ./gradlew check

...

BUILD SUCCESSFUL in 1m 5s
28 actionable tasks: 28 executed

UPD: added Windows based workflow here https://github.com/opensearch-project/opensearch-plugin-template-java/pull/51

dblock commented 5 months ago

Closing as resolved. Please comment/reopen if you see this again.