Gradle --no-daemon with IntelliJ -> desktop crashes


(Max Kobelt) #1

Hey, I’m trying to debug the latest commit from the master branch from Gradles GitHub.
I set the app’s working directory to my Gradle project and started the run task of my project, which involves launching a jsvc daemon.
For the first times it worked out, but suddenly my desktop began to crash and threw me back to the login screen.
But only if I set the --no-daemon option for the Gradle app.
The syslog doesn’t provide me with any helpful information though…

Using IntelliJ IDEA 2017.2

System Info:

Linux Mint 18.2 Cinnamon 64-bit
Cinnamon version: 3.4.4
Kernel version: 4.12.3-041203-generic
CPU: Intel Core i5-3210M
8 GB RAM
Graphics Card: Radeon HD 7500M/7600M Series

Any help is appreciated :slight_smile:

build.gradle (partially):

File jsvcFile = file("./jsvc")
File buildJsvcFile = file("./buildJsvc.sh")
File pidFile = file("./jsvc.pid")

String mainClass = "my.MainClass"

// Launches the shell script that'll build jsvc (https://commons.apache.org/proper/commons-daemon/jsvc.html)
task jsvc (type: Exec) {

    doFirst {

        executable(buildJsvcFile)

    }
}

// A clean will result in deleting the built jsvc exe
clean.delete(jsvcFile)

task run (dependsOn: [jar, jsvc], type: Exec) {

    doFirst {

        // Get the absolute path of all libraries
        String classPath = project.configurations.compile.join(':')

        executable(jsvcFile)

        args("-server", "-debug", "-cp", classPath + ':' + jar.archivePath, "-nodetach", "-cwd", project.rootDir, "-outfile", "/proc/self/fd/1", "-errfile", "/proc/self/fd/2", "-pidfile", pidFile, "-procname", project.name, mainClass, "debug")

    }
}

(Sterling Greene) #2

Does this happen with other versions of Gradle?

How are you starting the jsvc daemon?

You could try gradle run 2>&1 | tee out and see if anything interesting shows up in out after the crash.


(Max Kobelt) #3

This only happens when debugging or just simply running it from IDEA, which is weird, because it actually worked.
Running the command
java -javaagent:/opt/intellij-idea-community/plugins/Groovy/lib/agent/gragent.jar -Dfile.encoding=UTF-8 -classpath /path/to/all/jars org.gradle.debug.GradleRunConfiguration --no-daemon --debug run
(copied from IDEA) from my project directory results in

16:35:41.349 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Build operation 'Execute task action 1/4 for :run' completed
16:35:41.350 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Build operation 'Execute task action 2/4 for :run' completed
<==========---> 83% EXECUTING [6s]
> :run
Terminated

If I leave out the --no-daemon option, it’ll run fine.
I also reinstalled IDEA, mdm, cinnamon, xserver and whatever, but the problem persists.

My tasks are appended to the post.