You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During shutdown, I encounter the following error: uncaughtException: write EPIPE
Environment
Java client build version : 9.3.0
Appium server version : 2.11.2
Desktop OS/version : Mac Sequoia 15.0
Node.js : 20.15.0
Mobile platform/version under test: Android 14 (Motorola edge 30)
Real device or emulator/simulator: Real Device
Details
I have attempted to resolve this by using clearOutPutStreams(), disabling console logging, and ensuring log streams are flushed and closed, but the error persists.
Code To Reproduce Issue
public class AppiumServerManager {
private final int DEFAULT_APPIUM_SERVER_PORT = 4723;
private final AppiumDriverLocalService appiumDriverLocalService;
private final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
private boolean isAppiumRunning = false;
public AppiumServerManager(){
appiumDriverLocalService = getAppiumDriverLocalService();
appiumDriverLocalService.clearOutPutStreams();
}
private AppiumDriverLocalService getAppiumDriverLocalService() {
return AppiumDriverLocalService.buildService(new AppiumServiceBuilder()
.withIPAddress("127.0.0.1")
.withArgument(() -> "--long-stacktrace")
.usingPort(DEFAULT_APPIUM_SERVER_PORT)
.withArgument(GeneralServerFlag.LOG_LEVEL, DebugFlag.DEBUG_DEBUG.getArgument())
.withArgument(GeneralServerFlag.USE_DRIVERS, "uiautomator2")
.withArgument(() -> "-ka", "800")
.withTimeout(Duration.ofSeconds(30))
.withLogFile(new File(System.getProperty("user.dir") + File.separator + "appium_logs_" + System.currentTimeMillis() + ".log"))
);
}
public void startAppiumServer() {
if (!isAppiumServerRunning()) {
appiumDriverLocalService.start();
isAppiumRunning = true;
System.out.println(getCurrentTimestamp() + " - INFO: Appium Server Started on port " + DEFAULT_APPIUM_SERVER_PORT);
} else {
System.out.println(getCurrentTimestamp() + " - WARNING: Appium Server is already running.");
}
}
public void stopAppiumServer() {
try {
if (isAppiumRunning) {
System.out.println(getCurrentTimestamp() + " - INFO: Stopping Appium server with a delay...");
Thread.sleep(1000); // 2 second delay before fully stopping
appiumDriverLocalService.stop();
isAppiumRunning = false;
System.out.println(getCurrentTimestamp() + " - INFO: Appium Server Stopped.");
}
} catch (InterruptedException e) {
System.err.println("Error during shutdown delay: " + e.getMessage());
}
}
private boolean isAppiumServerRunning() {
if (appiumDriverLocalService == null) {
System.out.println(getCurrentTimestamp() + " - ERROR: Appium Driver Service has not been initialized.");
return false;
}
boolean isRunning = appiumDriverLocalService.isRunning();
System.out.println(getCurrentTimestamp() + " - INFO: Appium Server running status: " + (isRunning ? "Running" : "Not Running"));
return isRunning;
}
private String getCurrentTimestamp() {
return LocalDateTime.now().format(DATE_FORMATTER);
}
}
This exception usually means that stdout or stderr stream has been closed unexpectedly before the server process has been closed. Generally it means there is some race condition while closing the process.
From the server perspective the exception could be safely ignored, it does not affect much. You'd probably just not see some final server log lines as a result of this exception.
Also the main logic responsible for process and streams handling is at the Selenium lib side. There is not much we may change there from this library's perspective.
During shutdown, I encounter the following error: uncaughtException: write EPIPE
Environment
Details
I have attempted to resolve this by using clearOutPutStreams(), disabling console logging, and ensuring log streams are flushed and closed, but the error persists.
Code To Reproduce Issue
Link To Appium Logs
https://gist.github.com/dipakkumar1225/57756cacee02a6b124d8aeba8129f29b
The text was updated successfully, but these errors were encountered: