Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

CommandFailedException: Stream closed #116

Open
annappropriate opened this issue Dec 28, 2017 · 6 comments
Open

CommandFailedException: Stream closed #116

annappropriate opened this issue Dec 28, 2017 · 6 comments

Comments

@annappropriate
Copy link

Here's the exception stacktrace:

com.wix.mysql.exceptions.CommandFailedException: Command 'CREATE USER 'auser'@'%' IDENTIFIED BY 'sa';' on schema 'information_schema' failed with message 'Stream closed'
[info]   at com.wix.mysql.MysqlClient.execute(MysqlClient.java:73)
[info]   at com.wix.mysql.MysqlClient.executeCommands(MysqlClient.java:43)
[info]   at com.wix.mysql.EmbeddedMysql.<init>(EmbeddedMysql.java:48)
[info]   at com.wix.mysql.EmbeddedMysql$Builder.start(EmbeddedMysql.java:155)
[info]   at foo.Bar.beforeAll(Bar.scala:40)
[info]   at org.scalatest.BeforeAndAfterAll$class.liftedTree1$1(BeforeAndAfterAll.scala:212)
[info]   at org.scalatest.BeforeAndAfterAll$class.run(BeforeAndAfterAll.scala:210)
[info]   at foo.Bar.run(Bar.scala:23)
[info]   at org.scalatest.tools.Framework.org$scalatest$tools$Framework$$runSuite(Framework.scala:314)
[info]   at org.scalatest.tools.Framework$ScalaTestTask.execute(Framework.scala:480)
[info]   ...
[info]   Cause: java.io.IOException: Stream closed
[info]   at java.lang.ProcessBuilder$NullOutputStream.write(ProcessBuilder.java:433)
[info]   at java.io.OutputStream.write(OutputStream.java:116)
[info]   at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
[info]   at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
[info]   at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:297)
[info]   at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141)
[info]   at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
[info]   at org.apache.commons.io.IOUtils.copy(IOUtils.java:2128)
[info]   at com.wix.mysql.MysqlClient.execute(MysqlClient.java:59)
[info]   at com.wix.mysql.MysqlClient.executeCommands(MysqlClient.java:43)
[info]   ...

Tried with library versions 3.0.0 and 2.2.10, MySQL version v5_6_latest.
Database does start, I was able to connect to it while tests were running.

@viliusl
Copy link
Collaborator

viliusl commented Jan 23, 2018

hm, that is an interesting one - can it be that process was being shutdown while initializing? I mean stop() called while starting? Does it work otherwise?

@codesplode
Copy link

codesplode commented Dec 6, 2018

I had this same issue with MySQL 5.7, while working on another open source project. I cloned the wix-embedded-mysql repository and ran the tests using the master branch, which also failed in the exact same way, except that I received a longer, more thorough message in the catch.

The issue was that I was on Ubuntu and did not have the ncurses 5 shared library installed. On ubuntu, I installed libncurses5 (apt install libncurses5) and everything started working (all tests on wix, and on my project).

I hope this helps resolve the issue.

@d12frosted
Copy link

Just run into exact same issue. Installing ncurses5-compat-lib from AUR on Arch Linux fixed this for me.

@RedefineMike thanks for the hint about ncurses.

@despot
Copy link

despot commented Mar 10, 2020

Is anyone still having issues? Did you find another solution?

Including
RUN apt-get install -y libncurses5-dev libncursesw5-dev
in my 'FROM openjdk:11-jre' image Dockerfile, didn't fix this for me.

I read that this image is based on Debian OS. The exception is the same as for @annappropriate.

I have wix-embedded-mysql 4.2.0 in my pom.xml and I can see:
Extract /root/.embedmysql/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz START
...
Extract /root/.embedmysql/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz DONE
1: INFO MysqldExecutable - Preparing mysqld for startup
1: INFO MysqldExecutable - Starting MysqldProcess
1: INFO Executable - start com.wix.mysql.config.MysqldConfig@1744a475
1: ERROR TomcatStarter - Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message: Error creating bean with name 'servletEndpointRegistrar' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.class]: ...Constructor threw exception; nested exception is com.wix.mysql.exceptions.CommandFailedException: Command 'CREATE USER 'test'@'%' IDENTIFIED BY 'test';' on schema 'information_schema' failed with message 'Stream closed'

The whole Dockerfile is:
FROM openjdk:11-jre
ENV DEBIAN_FRONTEND noninteractive
ENV DEBIAN_FRONTEND teletype
RUN apt-get update
RUN apt-get install -y apt-utils
RUN apt-get install libaio1
RUN apt-get install libnuma1
RUN apt-get install -y libncurses5-dev libncursesw5-dev
RUN apt-get install libssl1.0 libcrypto++6
ADD target/.jar app.jar
EXPOSE 1111
EXPOSE 2222

@despot
Copy link

despot commented Mar 10, 2020

Hi @gloeglm ,

would you mind telling me how you got it working on debian, taken "I can run the build no problem in a docker container based on debian for example" from #141 ?

Kind Regards

@khatkar
Copy link

khatkar commented Oct 27, 2020

I was having the same issue running MySql 5.6 on Ubuntu 20.10. It already had libncurses6 library but was failing. Installed libncurses5 and the tests run fine.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants