Exception when running with ansible shell module
- Dominant language
- Java
- Stars
- 3.5k
- Forks
- 250
- Avg merge
- 16h 22m
- Merged PRs (30d)
- 36
Description
Ansible command:
- name: Build project
local_action:
module: shell
cmd: "mvnd --batch-mode --log-file build_log.txt --projects web/{{ artifact_name }} clean verify --also-make"
args:
chdir: ../../
run_once: true
Exception in thread \"main\" java.lang.RuntimeException: Could not write to build_log.txt\n\tat org.mvndaemon.mvnd.common.logging.TerminalOutput$FileLog.accept(TerminalOutput.java:907)\n\tat org.mvndaemon.mvnd.common.logging.TerminalOutput.doAccept(TerminalOutput.java:333)\n\tat org.mvndaemon.mvnd.common.logging.TerminalOutput.accept(TerminalOutput.java:204)\n\tat org.mvndaemon.mvnd.client.DefaultClient.execute(DefaultClient.java:399)\n\tat org.mvndaemon.mvnd.client.DefaultClient.main(DefaultClient.java:169)\n\tat java.base@22.0.1/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)\nCaused by: java.io.IOException: Stream closed\n\tat java.base@22.0.1/java.io.BufferedWriter.ensureOpen(BufferedWriter.java:132)\n\tat java.base@22.0.1/java.io.BufferedWriter.implWrite(BufferedWriter.java:325)\n\tat java.base@22.0.1/java.io.BufferedWriter.write(BufferedWriter.java:313)\n\tat java.base@22.0.1/java.io.Writer.write(Writer.java:278)\n\tat org.mvndaemon.mvnd.common.logging.TerminalOutput$FileLog.accept(TerminalOutput.java:904)\n\t... 5 more", "stderr_lines": ["Sep 24, 2024 4:46:27 PM org.jline.utils.Log logr", "WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)", "[main] WARNING org.jline - Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)", "[main] WARNING org.mvndaemon.mvnd.client.DaemonParameters - Falling back to finding JAVA_HOME by running java executable available in PATH. You may want to avoid this time consuming task by setting JAVA_HOME environment variable or by passing java.home system property through command line or in one of mvnd configuration files.", "Exception in thread \"main\" java.lang.RuntimeException: Could not write to build_log.txt", "\tat org.mvndaemon.mvnd.common.logging.TerminalOutput$FileLog.accept(TerminalOutput.java:907)", "\tat org.mvndaemon.mvnd.common.logging.TerminalOutput.doAccept(TerminalOutput.java:333)", "\tat org.mvndaemon.mvnd.common.logging.TerminalOutput.accept(TerminalOutput.java:204)", "\tat org.mvndaemon.mvnd.client.DefaultClient.execute(DefaultClient.java:399)", "\tat org.mvndaemon.mvnd.client.DefaultClient.main(DefaultClient.java:169)", "\tat java.base@22.0.1/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)", "Caused by: java.io.IOException: Stream closed", "\tat java.base@22.0.1/java.io.BufferedWriter.ensureOpen(BufferedWriter.java:132)", "\tat java.base@22.0.1/java.io.BufferedWriter.implWrite(BufferedWriter.java:325)", "\tat java.base@22.0.1/java.io.BufferedWriter.write(BufferedWriter.java:313)", "\tat java.base@22.0.1/java.io.Writer.write(Writer.java:278)", "\tat org.mvndaemon.mvnd.common.logging.TerminalOutput$FileLog.accept(TerminalOutput.java:904)", "\t... 5 more"], "stdout": "", "stdout_lines": []}
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the Ansible shell command with --log-file build_log.txt, then inspect TerminalOutput.java around FileLog lines 904 and 907 and the callers shown in the stack trace. Determine why the log writer is closed before the command finishes; done means the command completes without the Stream closed exception and writes the requested log file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ansible, java
- Domain
- build-system, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100