Closed latcomsystems closed 3 years ago
Version: 1.44.2 (user setup) Commit: ff915844119ce9485abfe8aa9076ec76b5300ddd Date: 2020-04-16T16:36:23.138Z Electron: 7.1.11 Chrome: 78.0.3904.130 Node.js: 12.8.1 V8: 7.8.279.23-electron.0 OS: Windows_NT x64 10.0.18363
Name: Community Server Connectors Id: redhat.vscode-community-server-connector Description: Connects vscode with open source community-driven servers and runtimes. Version: 0.23.3 Publisher: Red Hat VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=redhat.vscode-community-server-connector
So there are two issues here. First is the two minute timeout. The timeout can now be configured as per https://github.com/redhat-developer/rsp-server/issues/587 In short, if you edit the server and add a flag like "server.timeout.startup": "120000" you can override the number to any number of miliseconds you want.
But obviously that's not the important issue here. Your issue is that polling seems to fail no matter what. To determine if the server is up or down, we make an http request at host:port so for example http://localhost:8080 or similar to see what the response is. If you have a different port in use, you may need to override that setting, also by editing the server, and adding a field like "server.http.port": "9000" or whatever port you want.
If you are pretty sure your server is running on port 8080, and is binding to localhost, then test it in a web browser. We only check http://localhost:${server.http.port} to see if an http response is provided. If you've changed the host, well, we don't have a way to override that part for tomcat just yet. It's an oversight on our part.
Did you change the host? Do we need to check a particular IP address or similar?
Thank you for your response Rob!
I'm 100% positive the port is still 8080. Nothing has changed on the application side since the last time this setup worked, which was about two months ago. The only difference is a couple of VSCODE and plugin updates since then. I can actually use the web app in the browser for a minute or two after the log shows "Server startup in xxxxx milliseconds" (see the screenshot above). The status in the left panel still shows "starting..." at this point. A minute or two later, the status changes to "stopped", nothing new shows up in the console log, and the web app stops working - no more responses from server on 8080.
I can try fiddling with the timeout setting, but won't get to it until Monday.
Fiddling with the timeout won't actually fix anything ;) Our app still must be trying to access http://localhost:8080
Are you 100% sure your tomcat server is started bound to "localhost" and not an IP address? What do you type in your web browser to view your app?
Yep, 100% sure it's localhost.
This is when the server is "starting":
And this is when it stops after about a minute:
If you have some time during the week, I would be more than happy to do a quick Google Meet and a screen share to demonstrate this if that would be helpful.
Here are some logs that show the server starting up, and the browser accessing it. Nothing in here about why it shuts down unexpectedly. localhost_access_log.2020-09-19.txt catalina.2020-09-19.log localhost.2020-09-19.log
It's shutting down unexpectedly because the RSP process is terminating it. The reason it is terminating it is because the poller has not returned that the server is started yet. Basically, when we launch a server process, we also check to see if it's alive for up to 2 minutes. If the server doesn't respond to our requests, we terminate its process and kill it.
Our polling method is what we call a web port poller. We go to localhost:yourport, in this case http://localhost:8080 and we check the response.
You have demonstrated through your screenshots that localhost:8080/srd-test/index.html returns content. What happens if you just go to localhost:8080/ ? We basically do a curl or wget or http request to that url and check the response code. If we get an error, we mark it as not yet started.
Here's the java code we're basically using to check if the server is up:
private SERVER_STATE onePing(String url) {
URLConnection conn = null;
try {
URL pingUrl = new URL(url);
conn = pingUrl.openConnection();
((HttpURLConnection)conn).getResponseCode();
return SERVER_STATE.UP;
} catch( FileNotFoundException fnfe ) {
return SERVER_STATE.UP;
} catch (MalformedURLException e) {
// Should NEVER happen since the URL's are hand-crafted, but whatever
// Status s = new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, e.getMessage(), e);
// JBossServerCorePlugin.log(s);
} catch (IOException e) {
// Does not need to be logged
return SERVER_STATE.DOWN;
} finally {
if( conn != null ) {
((HttpURLConnection)conn).disconnect();
}
}
return SERVER_STATE.DOWN;
}
This is http://loalhost:8080
And here is the network inspector in the browser, all returning 200 until the server shuts down about a minute later.
I have some news. I was able to resolve my problem by setting up a new tomcat server version 8.5.50 through the connector and everything is working. Looks like tomcat 9.0.30 is the problem. I remember, the original setup that worked was 9.0.27 and there were no issues. One of the VSCODE plugin updates updated the server to 9.0.30 and that is when I believe the problem started. So, for now, I'm all set with version 8.5.
That's still very weird but I'm glad to hear the connector is working again. I'll close this as not_rsp I guess... But if it happens again or with another version you should re-open this bug.
Happens at my end with Wildfly 25 I can freely access server via browser at localhost:8080 but still stuck at "Starting" state { "jboss.server.host": "localhost", "jboss.server.port": "8080" }
This started happening in the last two weeks. Everything worked fine before.
These are the last lines of log output:
16-Sep-2020 08:53:09.105 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"] 16-Sep-2020 08:53:09.114 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"] 16-Sep-2020 08:53:09.117 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [89,501] milliseconds
Nothing after that. I can use the server for less than a minute, then it stops. Status goes to "starting", then eventually "stopped". Never gets to fully "started".