-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OutOfMemoryError caused by UnixProcess holding all output written to stdout #427
Comments
Hello, I see no reason to keep the output into a ByteArrayOutputStream, specially if the output is directed into another stream (drainTo) which is set by the environment variable "webdriver.firefox.log". Seems to me that the only purpose of the inputOut variable is perhaps for some debugging of UnixProcess, since it is only used by getStdOut(), which returns the contents of all the console output ever produced. Could we eliminate the method getStdOut() from the class UnixProcess ? The variable inputOut could be set to System.out (so, by default printing the output of the plugins calling console.print) or something equivalent to org.apache.commons.io.output.NullOutputStream (in this case, by default the output would go into a black hole ) Alternatively, inputOut could keep just the last N bytes of output rather holding the entire console output ever produced. |
@cerebrotecnologico that pull request was abandoned and no one has submitted another one. Pull requests appreciated? :) |
@cerebrotecnologico another idea would be to let the user of UnixProcess decide what kind of outputstream they want with a setter and set the default to NullOutputStream. An OOM error could still happen if someone uses a ByteArrayOutputStream but then at least the user has control over that. Generally, isn't it bad to eliminate a public method like getStdOut() from the class's interface? Side note, "drainTo" isn't actually combined with "inputOut" at any point. They're held and written to in parallel inside a MultioutputStream, for some reason. |
I think we can change ByteArrayOutputStream to CircularOutputStream. |
…event OOM exception. Fixes issue #427
Fixed by commit d4a21ae |
I believe the documentation on running firefox needs to be added with d4a21ae. I'm not getting this error locally:
|
Actually, which maven dependency has |
@jsdevel it's in selenium-remote-driver - http://repo1.maven.org/maven2/org/seleniumhq/selenium/selenium-remote-driver/2.52.0/selenium-remote-driver-2.52.0.jar (and it's included in the standalone jar) |
I don't see it in standalone. |
@jsdevel i just downloaded again - http://selenium-release.storage.googleapis.com/2.52/selenium-server-standalone-2.52.0.jar and "org/openqa/selenium/io/CircularOutputStream.class" is in it. |
The class org.openqa.selenium.os.UnixProcess contains the following method:
private final ByteArrayOutputStream inputOut = new ByteArrayOutputStream();
private OutputStream getOutputStream() {
return drainTo == null ? inputOut
: new MultioutputStream(inputOut, drainTo);
}
The variable inputOut is a ByteArrayOutputStream, holding anything that is written in stdout into an array of bytes. The contents are never eliminated, therefore, all output is accumulated, eventually producing the OutOfMemoryError.
The text was updated successfully, but these errors were encountered: