vertx-gradle-plugin icon indicating copy to clipboard operation
vertx-gradle-plugin copied to clipboard

Problems with vertxRun task

Open bgurung opened this issue 5 years ago • 18 comments

Hi,

I have the following in build.gradle:

vertx {
    mainVerticle = 'com.sample.SampleService'
}

vertxDebug {
    jvmArgs = ['-Dvertx.logger-delegate-factory-class-name=io.vertx.core.logging.SLF4JLogDelegateFactory']
}

vertxRun {
    jvmArgs = ['-Dvertx.logger-delegate-factory-class-name=io.vertx.core.logging.SLF4JLogDelegateFactory']
}

When I use vertxDebug, it works as expected.

But when I use vertxRun, I see the following issues:

  1. The specified jvmArgs is not passed along.
  2. On the command window, termination using [Ctrl] + [C] does not kill server. It keeps running in the background, and I get BindException because the port is occupied.

I am using Windows 10 and Java 8.

bgurung avatar Oct 05 '18 22:10 bgurung

Hi, what versions of Gradle and the plugin are you using?

jponge avatar Oct 19 '18 09:10 jponge

Gradle 4.8 and PlugIn: 0.1.0. I switch to shadowjar plugin, and I don't see that issue with it. It's only with this plugin that I have to kill the process manually after stopping it, both on the IDEA or on CMD window (Ctrl+C).

bgurung avatar Oct 19 '18 15:10 bgurung

I can confirm that issue. The same configuration runs great on Linux/OSX but fails on Windows 10/Java 8.

vertxDebug works, but vertxRun does not pass proper jvmArgs.

mpodlodowski avatar Jan 08 '19 08:01 mpodlodowski

Is there any new on this issue? @jponge Because I can confirm same issue too.

duruer avatar Jan 10 '20 16:01 duruer

How about with a recent version?

jponge avatar Jan 10 '20 17:01 jponge

Gradle: 6.0.1 Vertx Gradle Plugin: 1.0.1 JDK: 8 8u231 OS: Windows 10

Everything is pretty updated.

duruer avatar Jan 10 '20 17:01 duruer

Plain Windows or WSL?

Sorry I can’t test on Windows.

jponge avatar Jan 10 '20 17:01 jponge

Plain Windows.

duruer avatar Jan 10 '20 17:01 duruer

There is no problem with vertxDebug but with vertxRun there is.

duruer avatar Jan 10 '20 17:01 duruer

In VertxPlugin.kt the flags are being passed.

Perhaps you could investigate?

On 10 Jan 2020, at 18:32, Ahmet Enes Duruer [email protected] wrote:

There is no problem with vertxDebug but with vertxRun there is.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

jponge avatar Jan 10 '20 18:01 jponge

I'm sorry but I quite don't know how to investigate this issue even I know Kotlin. But I can help about testing and debugging I guess.

duruer avatar Jan 10 '20 18:01 duruer

Ok I've made a quick sample:

package sample;

import io.vertx.core.Vertx;
import io.vertx.core.AbstractVerticle;

public class App extends AbstractVerticle {

  @Override
  public void start() {
    String message = System.getProperty("message", "You fail");
    vertx
      .createHttpServer()
      .requestHandler(req -> req.response().end(message)).listen(18080);
  }
}

with the following Gradle bits:

// (...)

vertx {
  mainVerticle = 'sample.App'
  jvmArgs = ['-Dmessage=Vert.x']
}

Then I ran: gradle vertxRun and did a HTTP request:

http :18080
HTTP/1.1 200 OK
content-length: 6

Vert.x

Works for me...

jponge avatar Jan 10 '20 21:01 jponge

Is the Ctrl + C working?

duruer avatar Jan 10 '20 21:01 duruer

Yes, Gradle reacts fine to SIGINT

On 10 Jan 2020, at 22:18, Ahmet Enes Duruer [email protected] wrote:

Is the Ctrl + C working?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

jponge avatar Jan 10 '20 22:01 jponge

All reports point to Windows. I don't have a Windows machine and the issue does not seem reproducible on any Unix system.

Until somebody with Windows expertise volunteers to look what could be wrong, I'll put this issue on hold.

jponge avatar Jan 10 '20 22:01 jponge

Well, I'm not a Windows expert but yeah everything works fine on Unix system and moreover yeah all issues targeting to the Windows and they are not producable in Unix. In fact unfourtanetly I can only try the code.

duruer avatar Jan 10 '20 22:01 duruer

I'm using windows 18363.815 and for now even if running following code:

def mainVerticleName = 'com.MainVerticle'
def watchForChange = 'src/**/*'
def doOnChange = './gradlew classes'

run {
  args = ['run', mainVerticleName, "--redeploy=$watchForChange", "--launcher-class=$mainClassName", "--on-redeploy=$doOnChange"]
}

, Ctrl + C does not work properly. I'm thinking there's someting went wrong with watchOnChange, or vert.x didn't receive stop signal.

Somiona avatar May 16 '20 05:05 Somiona

Pretty sure the problem is with the Vertx launcher code and not specifically this gradle plugin. If you run it without gradle the same problem occurs in Windows.

re-thc avatar Jan 09 '21 04:01 re-thc