Failed to connect to AltUnity Tester on host: 127.0.0.1 port: 13000.
private void connectunity() {
AltUnityPortForwarding.forwardAndroid();
try {
altdriver = new AltUnityDriver();
}catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
I'm trying to connect to AltUnity server using appium, Im connect to port 13000 and "the AltUnity pop up waiting for connection on port 13000" disappearing after connection but still unable to initiate the driver getting the error.
note: I've referred the docs related to altunity but and tried different ways to initialize the alt unity driver but none of them are working
Related
Using IIS, ASP.NET Core 2.2 and RestSharp V106.6.10 via Nuget on multiple servers getting exceptions after a period of time. My API calls with RestSharp work for a while then all of a sudden they start failing with common exception messages such as...
"ErrorException:System.Net.WebException: An error occurred while sending the request. Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.IO.IOException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond"
This occurs on multiple servers and I have yet to determine the source of the issue.
I have tried to create RestClient per call and also as a singleton with the same exception in both cases. I have also tried using syncrhonously as well as async all the way from the controller to the server call. In all cases I continue to get the above failure messages after a period of time.
Restarting the apppool does not resolve the issue. The only thing that will resolve this is a server reboot. I believe it has something to do with http client connections and reaching some limit but have yet to determine why i continue to have this issue.
Any help would be greatly appreciated. (Reference also https://github.com/restsharp/RestSharp/issues/1322)
Code currently looks like...
var defaultTimeout = 5 * 60 * 1000;
_restClientTimeout = defaultTimeout;
_restClientReadWriteTimeout = defaultTimeout;
_requestTimeout = defaultTimeout;
_client = new RestClient(_fastFieldBaseUrl);
_client.Timeout = _restClientTimeout;
_client.ReadWriteTimeout = _restClientReadWriteTimeout;
var request = new RestRequest(url, Method.POST);
request.Timeout = _requestTimeout;
request.ReadWriteTimeout = _requestTimeout;
request.AddHeader("Content-Type", "application/json");
request.AddParameter("body", json, ParameterType.RequestBody);
try
{
var response = await _client.ExecuteTaskAsync(request);
if (response.StatusCode == HttpStatusCode.Created)
{
return response.RawBytes;
}
else
{
var message= $"ExecuteTaskAsync raw bytes is null GetResponseMessage(response)}";
Log(message, traceIdentifier, null, Microsoft.Extensions.Logging.LogLevel.Error);
return null;
}
}
catch (Exception e)
{
var message = $"Error: {e.ToString()}";
Log(message, traceIdentifier, e, Microsoft.Extensions.Logging.LogLevel.Error);
}
In the startup method of my application I want to check that the credentials for MongoDB provided to the application are OK. If they are OK, I continue the startup, if not, the application is supposed to exit as it cannot connect to the DB. The code snippet is as below:
// Create the client
MongoClient mongodb = null;
try {
mongodb = MongoClient.createShared(vertx, mongo_cnf, mongo_cnf.getString("pool_name"));
}
catch(Exception e) {
log.error("Unable to create MongoDB client. Cause: '{}'. Bailing out", e.getMessage());
System.exit(-1);
}
If I provide wrong credentials, the catch block is not called. Yet I get the following on the console:
19:35:43.017 WARN org.mongodb.driver.connection - Exception thrown during connection pool background maintenance task
com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=null, userName='user', source='admin', password=<hidden>, mechanismProperties={}}
at com.mongodb.connection.SaslAuthenticator.wrapException(SaslAuthenticator.java:162)
at com.mongodb.connection.SaslAuthenticator.access$200(SaslAuthenticator.java:39)
... many lines
The question is: how to intercept this exception in my code and be able to handle it properly ?
The exception is happening in the mongodb's java driver daemon thread so you cannot catch it.
Vertx MongoClient abstracts you from direct interaction with MongoDB Java driver so you can't modify anything related to the client.
You could access mongo client instance via reflection, but as it's already created you cannot pass additional configuration to it.
If you used com.mongodb.async.client.MongoClient you could pass ServerListener which could access the exception and you could examine it (please see this answer for more details - https://stackoverflow.com/a/46526000/1126831).
But it's only possible to specify the ServerListener in the moment of construction of the mongo client, which happens inside the Vertx MongoClient wrapper and there's no way to pass this additional configuration.
Currently the exception is not thrown, which in my opinion a mistake in design, since you receive an object that you cannot work with. Feel free to open a bug: https://github.com/vert-x3/vertx-mongo-client/issues
What you can do to detect that your client is "dead or arrival" is to wait for connection timeout:
// Default is 30s, which is quite long
JsonObject config = new JsonObject().put("serverSelectionTimeoutMS", 5_000);
MongoClient client = MongoClient.createShared(vertx, config, "pool_name");
client.findOne("some_collection", json1, json2, (h) -> {
if (h.succeeded()) {
//...
}
else {
// Notify that the client is dead
}
});
I am trying to implement an interface for my erlang program using jinterface. When I call the command OtpNode otpNode = new OtpNode(nodeName, cookie); java throws an IOException with
java.io.IOException: Nameserver not responding on DESKTOP-GIR29G3 when publishing javanode.
It doesn't seem to be common problem for people as I couldn't find anything similar online. It's a local node with the node name being "javanode" with no fullstops or dashes. Why would there be a DNS issue on a local node?
I have tried starting an erlang node in the directory the java program is started as well as starting the erlang console on my pc, but I'm very new to erlang so those were just wild guesses that some erlang VM must be running.
Here is the code that may help:
public Erlterface()
{
Thread t = new Thread(new Runnable() {
public void run() {
setupMBox();
}
});
t.start();
}
private void setupMBox()
{
try {
String nodeName = "javanode";
String cookie = "jinterface";
//String[] names = OtpEpmd.lookupNames();
OtpNode otpNode = new OtpNode(nodeName, cookie); //CRASH HAPPENS HERE
OtpMbox Mbox = otpNode.createMbox("javaserver");
The error from the console:
Connected to the target VM, address: '127.0.0.1:54025', transport: 'socket'
java.io.IOException: Nameserver not responding on DESKTOP-GIR29G3 when publishing javanode
at com.stellar.base.schedule.com.ericsson.otp.erlang.OtpEpmd.r4_publish(OtpEpmd.java:344)
at com.stellar.base.schedule.com.ericsson.otp.erlang.OtpEpmd.publishPort(OtpEpmd.java:141)
at com.stellar.base.schedule.com.ericsson.otp.erlang.OtpNode$Acceptor.publishPort(OtpNode.java:784)
at com.stellar.base.schedule.com.ericsson.otp.erlang.OtpNode$Acceptor.<init>(OtpNode.java:776)
at com.stellar.base.schedule.com.ericsson.otp.erlang.OtpNode.init(OtpNode.java:232)
at com.stellar.base.schedule.com.ericsson.otp.erlang.OtpNode.<init>(OtpNode.java:196)
at com.stellar.base.schedule.com.ericsson.otp.erlang.OtpNode.<init>(OtpNode.java:149)
at com.stellar.base.schedule.Erlterface.setupMBox(Erlterface.java:40)
at com.stellar.base.schedule.Erlterface.access$000(Erlterface.java:16)
at com.stellar.base.schedule.Erlterface$1.run(Erlterface.java:26)
at java.lang.Thread.run(Thread.java:745)
Thanks in advance
Dale
UPDATE ADDITIONAL INFORMATION:
I went into a dive to try and figure out where exactly the train leaves the rails but I'm taking wild guesses as to what I should flag as potential issues. I just want to add some additional information here to help:
In OptEpmd the following is caught before the io exception is thrown
java.net.ConnectException: Connection refused: connect
The final source is the native DeulSocketImpl class that I suppose calls on windows to do the final connection thingamabob ad it fails:
static native int connect0(int var0, InetAddress var1, int var2) throws IOException;
Am I missing something in setting up the erlang node? I surely don't have to start it manually? I've diabled my firewall completely to test it. How do I figure out why the connection was refused?
In the QF event log there are session layer events:
20180418-13:30:51.268 : Connection failed: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond #.#.#.#:#
20180418-13:31:00.288 : Connecting to #.#.#.# on port #
20180418-13:31:21.293 : Connection failed: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond #.#.#.#:#
20180418-13:31:00.288 : Connecting to #.#.#.# on port #
What's the event handler to use to report / react to these events? The OnLogout handler is not being called.
I don't want to use FromEarlyIntercept that I guess would catch the event?
This behavior is by design - there was no connection established, no logon done, so no OnLogout event after network failure when connecting.
You can see the source code for that part - FromEarlyIntercept is also not triggered in this case. QuickFix/n just logs the error and will try to reconnect after ReconnectInterval seconds.
try
{
t.Connect();
t.Initiator.SetConnected(t.Session.SessionID);
t.Session.Log.OnEvent("Connection succeeded");
t.Session.Next();
while (t.Read())
{ }
if (t.Initiator.IsStopped)
t.Initiator.RemoveThread(t);
t.Initiator.SetDisconnected(t.Session.SessionID);
}
catch (IOException ex) // Can be exception when connecting, during ssl authentication or when reading
{
t.Session.Log.OnEvent("Connection failed: " + ex.Message);
}
catch (SocketException e)
{
t.Session.Log.OnEvent("Connection failed: " + e.Message);
}
I am using install4j to install an intranet application which requires an HTTP and HTTPS port. I would like to test that these ports are available and warn the user/block the installation until they select unavailable ports.
The only avenue I see for this (besides custom code) is to ensure the windows service fails if the application cannot bind to needed ports, and use a Failure Strategy "Ask user whether to retry or quit on failure". In the web server startup code, I use System.exit(1) if the server cannot bind to ports. However, this does not appear to register as a failure to the installer - the installation proceeds without invoking the failure strategy.
What is the proper approach for signaling failure to the "Start a service" action? Have other people taken an alternate approach to guaranteeing the installation uses available ports?
A good alternate approach I've since found: add a custom code action:
List<Integer> takenPorts = new ArrayList<Integer>();
for (int port : Arrays.asList(80, 443)) {
java.net.ServerSocket socket = null;
try {
socket = new java.net.ServerSocket(port);
} catch (IOException e) {
takenPorts.add(port);
} finally {
if (socket != null) socket.close();
}
}
if (takenPorts.isEmpty()) {
return true;
}
else {
String msg;
if (takenPorts.size() == 2) {
msg = "Ports 80 and 443 must be available for uDiscovery";
}
else {
msg = "Port " + takenPorts.get(0) + " must be available for uDiscovery";
}
context.setVariable("portErrorMessage", msg);
return false;
}
Good explanation of how to wire this up here
All who are just getting an error dialog telling
"com.install4j.runtime.beans.action.control.RunScriptAction failed"
I think that also was the one, Adam got:
In the srciptlet above the variable named portErrorMessage was set.
I also didn't realise that first. The trick is quite simple: You have to insert ${installer:portErrorMessage} in the field "Error message". Doing so, you don't need the Util.showOptionDialog described by Ingo, since that method call opens another, second dialog that has to be acknowledged first, after that the user would have to acknowloedge the dialog from install4j, too.