1

I have a Maven Java GAE (Google App Engine) project in Eclipse Oxygen Release 4.7.2 and Google Cloud Tools for Eclipse plugin version 1.5.0. I'm running my Eclipse in a Windows 10 machine.

I have simple a Servlet class in my code:

package it.ale.test;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet(name = "HelloAppEngine", urlPatterns = { "/hello" }, loadOnStartup = 1)
public class HelloAppEngine extends HttpServlet {

    @Override
    public void init() throws ServletException {

        super.init();

        System.out.println("Print something.");

    }

    @Override
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {

        response.setContentType("text/plain");
        response.setCharacterEncoding("UTF-8");

        response.getWriter().print("Hello App Engine!\r\n");

    }

}

when I put a debug breakpoint on any line of the "public void init()" function, example on the line:

System.out.println("Print something.");

and I start the server in DEBUG mode (Debug As -> App Engine), the server startup is incredible SLOW and I reach the error message:

server app engine Standard at localhost was unable to start within 240 seconds. If the server requires more time, try increasing the timeout in the server editor.


UPDATE 16 January 2018:

in the meantime while the mistake is coming, Eclipse freeze and after that the Java process of the launched server remains hanging. So I cannot restart the server unless I kill the Java server process.

This is a screenshot that represents this point

Note that in the lower right corner the server's Java process has not yet been stopped

This is a screenshot that show the pending stopping state

So I cannot restart the server unless I kill the Java server process.

@BriandeAlwis Is there any log I can provide to help you better? Maybe is a Google Cloud SDK "gcloud" integration problem ?


UPDATE 16 January 2018:

I try to downgrade version in Google Cloud SDK:

  • Google Cloud SDK 172.0.0
  • app-engine-java 1.9.56
  • app-engine-python 1.9.60
  • bq 2.0.26
  • core 2017.09.15
  • gsutil 4.27

but the problem persists.

Now I'm back to the most current version highlighting the problem again.

  • Google Cloud SDK 184.0.0
  • app-engine-java 1.9.60
  • app-engine-python 1.9.65
  • bq 2.0.28
  • core 2018.01.15
  • gsutil 4.28
  • Hmm, something is wrong: I do this all the time, and startup is a second or two. Is _Run_ equally slow as _Debug_? Or can you try _Debug_ but with the breakpoints disabled (_Run > Skip All Breakpoints_)? – Brian de Alwis Jan 15 '18 at 15:06
  • Thanks for your response. No the Run is very quick, about a second or two. The problem occurs only when this INIT breakpoint is active. If I disable this breakpoint the DEBUG is fast as the RUN, about a second or two. I forgot to tell you that this problem I have highlighted on a Windows 10 machine. I thought the problem was my computer but I already highlighted the same problem on two other machines with Windows 8. – Alessandro Guerrini Jan 15 '18 at 17:41
  • I forgot ... the JVM I am currently using is Oracle JDK 8 version 1.8.0_151. I had the same problem with a previous version Oracle JDK 8 version 1.8.0_74. – Alessandro Guerrini Jan 15 '18 at 17:51
  • I suspect this is [a bug in Eclipse JDT](https://bugs.eclipse.org/bugs/show_bug.cgi?id=529833) that I've hit too. I've found that deleting the breakpoints in the _Variables_ view and then recreating the breakpoints will usually do the trick. – Brian de Alwis Jan 15 '18 at 21:48
  • Sorry @BriandeAlwis but I do not think this is the problem. When I start the Debug As operation the Eclipse freeze until I reach the error 'server app engine Standard at localhost was unable to start within 240 seconds. If the server requires more time, try increasing the timeout in the server editor.' After this I do not see anything in the "Variables" view and besides the Java process of the launched server remains hanging. So I cannot restart the server unless I kill the Java server process. Soon I try to update the post. – Alessandro Guerrini Jan 15 '18 at 23:53
  • Ah your update is helpful: I didn't realize that your Eclipse instance freezes too. I'm able to reproduce this too. This is a bug — let's take this up on the [CT4E issue](https://github.com/GoogleCloudPlatform/google-cloud-eclipse/issues/2727). – Brian de Alwis Jan 16 '18 at 13:59

3 Answers3

1

This has been fixed since Google Cloud Tools for Eclipse 1.6.0.

For those who are interested in the details, see https://github.com/GoogleCloudPlatform/google-cloud-eclipse/issues/2727.

Chanseok Oh
  • 3,920
  • 4
  • 23
  • 63
1

You can fix this issue by deleting your existing server and removing your all break points and restart again your project in app engine

Window->Show View->other->Servers(search for servers if doesn't exists) Window->Show View->other->Breakpoints(search for breakpoints if doesn't exists)

after that simply right click on servers and delete them refresh your work-space and run project it will work. Happy Coding.

0

I updated the plugin to version 1.5.1 and finally I saw that the problem of slow startup, both in DEBUG and in RUN has been solved.

In any case I found that the following problem persists:

In the meantime I discovered another bug ... try replacing the code of the INIT function with this code:

@Override
public void init() throws ServletException {

    super.init();

    if (true) {
          throw new RuntimeException();
    }

    System.out.println("Print something.");

}

in this way I force an exception to the start. Try to click on Run As -> App Engine and try to stop the server. The server remains hung in "STOPPING" state.

This means that if there is an exception in the startup code the server will not shut down anymore.

  • The other problem you mentioned is https://github.com/GoogleCloudPlatform/google-cloud-eclipse/issues/1964. This will be fixed in the next CT4E release. – Chanseok Oh Feb 23 '18 at 16:34