-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[🐛 Bug]: ExternalProcess produces a huge amount of excessive records which prevents to fetch/read CI logs #13096
Comments
@mykola-mokhnach, thank you for creating this issue. We will troubleshoot it as soon as we can. Info for maintainersTriage this issue by using labels.
If information is missing, add a helpful comment and then
If the issue is a question, add the
If the issue is valid but there is no time to troubleshoot it, consider adding the
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C),
add the applicable
After troubleshooting the issue, please add the Thank you! |
Can you add a daily run of your CI to use the nightly jar? It would be useful to know when this started breaking and try to address it before release. We can try to make sure we wait a day before making changes before a release, too just to make sure. |
I think there is nothing that could be done to avoid this message. In similar cases JDK issues had been rejected, e.g. this. As a workaround i would suggest to sleep for ~800 milliseconds before resuming to read the input stream, this should significantly reduce the number of warnings logged. |
I'm not quite sure if transferTo can resurrect itself once IOException has happened. Although putting a sleep would improve the situation anyway . |
Also the documentation for transferTo says:
|
@joerg1985 - What if we resorted to just warning once (the first time the error occurs)? I am going to assume that between subsequent failures, the pid and the exception are going to be the same. Something like this ? boolean warned = false;
while (process.isAlive()) {
try {
// we must read the output to ensure the process will not lock up
input.transferTo(output);
} catch (IOException ex) {
if (!warned) {
warned = true;
LOG.log(Level.WARNING,"failed to copy the output of process " + process.pid(),ex);
}
}
} |
@krmahadevan i think the best option is to close the streams like the documentation does suggest. Swallowing the exception might lead to a high cpu load until the process has terminated. @titusfortner is this okay for you or do you have other ideas? |
My only consideration here is that we should not be throwing warnings in logs if there isn't something a user can do to fix it. I don't see why the user needs to know this at all? Can we log as debug? |
When the loop is removed, the stream should be read to it's end without throwing a exception at all. The exception is raised when we try to read the allready closed stream again. In general it make sense to log a warning if a exception does happen, because something unexpected happens and would propably be ignored when the debug level is used. |
But if it is happening everywhere for every run, it seems like we do expect it? I do not know enough about how this works to know the right way to fix, only the above input on what I user should get to see in logs. 😁 So whatever you think is best |
Okay, so i will fix this to the best of my knowledge. This is no permanent decision, the fix might be changed if there are irrelevant messages logged. |
@mykola-mokhnach i just pushed a fix to this, thanks for reporting it! |
@joerg1985 this fix broke the CI, can you take a look? Thanks. |
@titusfortner thank you for the hint, i am currently looking into it |
I removed closing the streams, this somehow disturbs the process. |
Is it a straight revert and this issue still needs fixing? |
The loop is still removed, so this issue should still be fixed. |
Then I'll close this; we can re-open if we still see it as an issue with the nightly or after next release. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
What happened?
We use SIGINT to kill Appium process created using process builder (e.g. graceful shutdown). This closes the process stdout, but the process remains alive for a while.
There is this code in the ExternalProcess:
As a result the above while loop spins for a few seconds thus producing a huge amount of warnings that significantly increase the overall log size, so it cannot be even fetched from the CI properly or read in the browser. A single record looks like:
How can we reproduce the issue?
Run Appium Java client CI. Example: https://github.com/appium/java-client/actions/runs/6751224992/job/18359734036?pr=2067
Relevant log output
https://github.com/appium/java-client/actions/runs/6751224992/job/18359734036?pr=2067
Operating System
macos
Selenium version
4.15.2
What are the browser(s) and version(s) where you see this issue?
Appium
What are the browser driver(s) and version(s) where you see this issue?
Are you using Selenium Grid?
no
The text was updated successfully, but these errors were encountered: