简体   繁体   English

在GAE项目上进行调试时,Eclipse Oxygen会非常缓慢地启动服务器。 服务器进程挂起处于停止挂起状态

[英]Eclipse Oxygen very slow server startup when debug on GAE projects. Server process hangs in a stopping pending state

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. 我在Eclipse Oxygen版本4.7.2和适用于Eclipse插件版本1.5.0的Google Cloud Tools中拥有一个Maven Java GAE(Google App Engine)项目。 I'm running my Eclipse in a Windows 10 machine. 我正在Windows 10计算机上运行Eclipse。

I have simple a Servlet class in my code: 我的代码中有一个简单的Servlet类:

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: 当我在“ public void init()”函数的任何行上放置调试断点时,在该行上的示例:

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: 并且我以DEBUG模式(调试方式-> App Engine)启动服务器,服务器启动速度非常慢,并且出现错误消息:

server app engine Standard at localhost was unable to start within 240 seconds. 本地服务器服务器标准引擎无法在240秒内启动。 If the server requires more time, try increasing the timeout in the server editor. 如果服务器需要更多时间,请尝试在服务器编辑器中增加超时时间。


UPDATE 16 January 2018: 2018年1月16日更新:

in the meantime while the mistake is coming, Eclipse freeze and after that the Java process of the launched server remains hanging. 同时,在错误即将来临之时,Eclipse冻结,然后启动的服务器的Java进程仍然挂起。 So I cannot restart the server unless I kill the Java server process. 因此,除非取消Java服务器进程,否则无法重新启动服务器。

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 请注意,在右下角,服务器的Java进程尚未停止

This is a screenshot that show the pending stopping state 这是显示未决停止状态的屏幕截图

So I cannot restart the server unless I kill the Java server process. 因此,除非取消Java服务器进程,否则无法重新启动服务器。

@BriandeAlwis Is there any log I can provide to help you better? @BriandeAlwis我可以提供任何日志来帮助您更好吗? Maybe is a Google Cloud SDK "gcloud" integration problem ? 也许是Google Cloud SDK的“ gcloud”集成问题?


UPDATE 16 January 2018: 2018年1月16日更新:

I try to downgrade version in Google Cloud SDK: 我尝试降级Google Cloud SDK中的版本:

  • Google Cloud SDK 172.0.0 Google Cloud SDK 172.0.0
  • app-engine-java 1.9.56 app-engine-java 1.9.56
  • app-engine-python 1.9.60 app-engine-python 1.9.60
  • bq 2.0.26 bq 2.0.26
  • core 2017.09.15 核心2017.09.15
  • gsutil 4.27 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 Google Cloud SDK 184.0.0
  • app-engine-java 1.9.60 app-engine-java 1.9.60
  • app-engine-python 1.9.65 app-engine-python 1.9.65
  • bq 2.0.28 bq 2.0.28
  • core 2018.01.15 核心2018.01.15
  • gsutil 4.28 gsutil 4.28

This has been fixed since Google Cloud Tools for Eclipse 1.6.0. 自Eclipse 1.6.0的Google Cloud Tools以来,此问题已得到修复。

For those who are interested in the details, see https://github.com/GoogleCloudPlatform/google-cloud-eclipse/issues/2727 . 对于那些对细节感兴趣的人,请参阅https://github.com/GoogleCloudPlatform/google-cloud-eclipse/issues/2727

You can fix this issue by deleting your existing server and removing your all break points and restart again your project in app engine 您可以通过删除现有服务器并删除所有断点并再次在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. 编码愉快。

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. 我将插件更新为1.5.1版,最后我看到DEBUG和RUN中启动缓慢的问题已解决。

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: 同时,我发现了另一个错误...尝试用以下代码替换INIT函数的代码:

 @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 . 尝试单击运行方式-> App Engine,然后尝试停止服务器 The server remains hung in " STOPPING " state. 服务器仍挂在“ STOPPING ”状态。

This means that if there is an exception in the startup code the server will not shut down anymore. 这意味着,如果启动代码中存在异常,则服务器将不再关闭。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM