GWT-RPC和臭名昭着的零星“StatusCodeException:0”异常重访 [英] GWT-RPC and the infamous sporadic "StatusCodeException: 0" exception revisited

查看:593
本文介绍了GWT-RPC和臭名昭着的零星“StatusCodeException:0”异常重访的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是臭名昭着的StatusCodeException:0 https://sub.site.com/ 访问页面时,使用 GWT 2.6.1 时会出现问题。



现在,对于一个客户,使用IE11和我无法复制从几个不同的计算机使用IE11,IE10,IE9或IE8(不要谈论Chrome或Firefox)。



https访问完全相同的webapp ://site.com/ 似乎对该客户正常工作。



这显然导致我得出结论,我遇到了问题同源政策



但奇怪的是,我的 webapp是以无跨域的方式设计的 rong>跨子域请求。 没有跨协议以及没有跨端口请求也是如此。换句话说,在这种情况下,同源策略不受侵犯。作为对此的确认,我可以提供以下证据:


在客户网站时,我已经看到 客户开始使用应用程序一切正常 - 所有请求都正常返回响应。然后,工作几分钟后,同一页面上的相同请求(不带重新加载)开始失败 StatusCodeException: 0


基本上, https://sub.site.com https://site.com 指向相同的IP,并且仅有一个Tomcat webapp 提供完全相同的资源无论是 https://sub.site.com https://site.com



另一个证明是单个GWT模块本身的代码库:我只使用一个名为 DashboardService 的服务的实例:

  public class DashboardModule扩展了EntryPoint实现IDashboardModule {

private final DashboardServiceAsync dashboardService = createDashboardService();

@Override
public void onModuleLoad(){
//加载模块元素
// dashboardService作为参数传递,因此只使用一个实例

$ b $ **
*请参阅以下代码#1下面的代码片段
* /
private static final String DASHBOARD_REQUEST_URL =request;

private static DashboardServiceAsync createDashboardService(){
final DashboardServiceAsync service = GWT.create(DashboardService.class);
((ServiceDefTarget)服务).setServiceEntryPoint(DASHBOARD_REQUEST_URL);
退货服务;
}
}

========编辑====================== ==============



在客户位置查看控制台后,错误总是如下所示:



SCRIPT7002:XmlHttpRequest:网路错误0x2ee4,...

这与同源策略无关,因为按照这篇文章它被描述为 ERROR_INTERNET_INTERNAL_ERROR发生内部错误。



很遗憾,但我已经发现只有2提到这个错误没有解决:
IE10下的错误在IE11下的错误

我有一个假设客户很可能通过一些代理访问网站,这会略微改变请求,而IE不能处理它们。



问题1:是否有人知道我怎样才能在本地模拟或复制提到的错误?



问题2:有谁知道这个问题可以如何妥善解决?



问题3:可以简单地重试请求,或者此请求可能已到达服务器并进行修改,因此重试它可能会产生重复的修改?b / b>

将尝试设置转发代理来模拟可能的客户设置,以至少重现所提到的错误。 >我非常感谢任何帮助!

解决方案

好了,在解决这个工作周的问题之后, n
$ b实际上,当我在Tomcat前面安装Apache2服务器并从另一个VirtualBox Win7主机访问IE11时,我能够在本地再现非常类似的问题。虽然这给了我零星 StatusCodeException:0 网络错误0x2ef3 但行为非常类似:GWT-RPC请求开始在一分钟左右后失败。这是在IE10和IE11中可重现的,但在IE8和IE9中工作正常:)(是IE越来越使用新版本越来越cra?吗?
$ b 本地通过在 / etc /中添加以下行,简单地禁用IE浏览器的 Keep-alive 功能, apache2 / sites-enabled / default-ssl.conf Apache2 ssl配置文件:

 #following line增加了
BrowserMatchTridentnokeepalive ssl -ieanan-shutdown downgrade-1.0 force-response-1.0

< / VirtualHost>
< / IfModule>

这基本上告诉Apache2不要使用 keep-alive user-agent 字符串,请使用 特殊 SSL处理并通常降级到HTTP 1.0标准。 code> Trident 字(匹配IE11和IE10以及可能更早的IE)



添加了连接:close HTTP标题给每个响应,似乎很好本地



在客户网站上,这还没有起作用并生成相同的网络错误:0x2ee4



值得一提的是,客户使用的是 McAfee Web Gateway 作为站在浏览器<>服务器通信中间的转发代理。

长话短说,我发现问题出在如下:当页面加载时,有多个 GET 请求被发送到服务器以获取页面,资源等。然后在10秒钟后使用它(我的webapp是单页面应用程序,所以用户可能会花费超过10分钟在同一页面上),只有 GWT-RPC 请求被服务器 POST 请求。在使用此页面一分钟后(我怀疑代理服务器的1分钟= 保持活动超时),这些POST请求会随机发生,并出现0x2ee4网络错误。



在实现GWT-RPC重试功能之后,我发现重试30秒后, ALL GWT-RPC请求失败并出现上述错误。刷新页面是解决这个问题一分钟左右,然后发生同样的故事。



所以,我发现 CRAPPY IE11和IE10 不正确地处理SSL,Keep-alive和POST请求的组合。看起来,сrappyIE10和IE11 完全无法使用POST请求续订保持连接的SSL连接,只能使用GET请求来执行此操作。
请注意,Chrome,Firefox和其他普通浏览器正在很好地处理这种情况。当检查Firefox在Firebug的这种情况下的行为方式时:可以清楚地看到发出POST请求,然后显示为中止了0.5秒,然后显示它成功(我怀疑Firefox处理这种特定情况并且因此,为了解决这个问题,在IE中我简单地实现了ping功能,服务器每5秒发送一次GET请求(准备尝试这次,因为这很可能与客户的代理 keep-alive 超时有关)。



这使得它工作(请注意,在这种情况下,上面的Apache2配置hack不需要)

我真的希望这会帮助人们与类似的问题,并节省他们的时间



使用的资源:
$ b


  1. IE网络错误0x2ef3问题1 IE网络错误0x2ef3问题2
  2. IE网络错误0x2ef3问题3

  3. 关于如何实现透明的GWT-RPC重试功能的真棒问答

PS 我会向Microsoft报告此IE10和IE11问题吗? - 我已经花了超过一周的时间找到问题了,所以我并不急于花30分钟时间报告商业蹩脚的IE浏览器问题。



推荐Chrome Firefox 其他普通浏览器作为可行的替代方案,我坚持认为 IE11不适用于使用AJAX

的现代网站

My problem is the infamous "StatusCodeException: 0" problem happening when using GWT 2.6.1 when accessing page via subdomain https://sub.site.com/.

Now, this happens quite sporadically for one customer using IE11 and I can't reproduce this from several distinct computers using IE11, IE10, IE9 or IE8 (not to talk about Chrome or Firefox).

Accessing exactly the same webapp from https://site.com/ seems to work fine for that customer.

This obviously lead me to conclusion that I'm having problem with Same Origin Policy.

What is strange though is that my webapp is designed in the way that no cross-domain or cross-subdomain requests are made. Same goes for no cross-protocol as well no cross-port requests. In other words, Same Origin Policy is not violated in this situation. As a confirmation of that, I can provide following proof:

While being at customer site I've seen how this is reproduced: customer starts using application and everything works fine - all requests are returning response normally. Then, after several minutes of working, exactly the same requests on the same page (without reloads) starts to fail with StatusCodeException: 0.

Basically, both https://sub.site.com and https://site.com points to the same IP, and there is only one Tomcat webapp serving exactly the same resources both for https://sub.site.com and https://site.com.

Another proof would be the codebase of the single GWT module itself: there I use only one instance of one service called DashboardService:

public class DashboardModule extends EntryPoint implements IDashboardModule {

    private final DashboardServiceAsync dashboardService = createDashboardService();

    @Override
    public void onModuleLoad() {
        // loading of module elements 
        // dashboardService is passed as a parameter so only one instance is used
    }

    /**
     * PLEASE SEE QUESTION #1 BELOW CODE SNIPPET
     */
    private static final String DASHBOARD_REQUEST_URL = "request";

    private static DashboardServiceAsync createDashboardService() {
        final DashboardServiceAsync service = GWT.create(DashboardService.class);
        ((ServiceDefTarget) service).setServiceEntryPoint(DASHBOARD_REQUEST_URL);
        return service;
    }
}

=================================== EDIT ====================================

After looking in the console at customer location, the error was always the following:

SCRIPT7002: XmlHttpRequest: network error 0x2ee4, ...

so it seems that this has nothing to do with Same-Origin Policy, because as per this article it is described as ERROR_INTERNET_INTERNAL_ERROR An internal error has occurred.

It's a pity, but I've found only 2 mentions of this error which were not resolved: Error under IE10 and Error under IE11.

I have an assumption that customer is very probably accessing site through some proxy which slightly changes the requests and IE can't handle them.

Question 1: does anybody knows how can I simulate or reproduce mentioned error locally?

Question 2: does anybody knows how this problem can be gracefully worked around?

Question 3: is it ok to simply retry the request, or this request may have reached the server and modify it, so retrying it may produce duplicate modification?

Will try to setup forwarding proxy to simulate possible customer setup to at least reproduce mentioned error...

I greatly appreciate any help!

解决方案

Ok, so after bugging with this problem for a workweek I finally managed to solve it.

Actually, I was able to reproduce very similar problem locally when I installed Apache2 server in front of Tomcat and accessed it from another VirtualBox Win7 host with IE11. This gave me sporadic StatusCodeException: 0 with Network error 0x2ef3 though but the behaviour was very similar: GWT-RPC requests started to fail after a minute or so. This was reproducable in IE10 and IE11 but working fine in IE8 and IE9 :) (is IE getting crappier with new versions?)

Locally I was able to fix that problem by simply disabling Keep-alive functionality for IE browsers by adding following lines to /etc/apache2/sites-enabled/default-ssl.conf Apache2 ssl configuration file:

    # following line was added
    BrowserMatch "Trident" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0

</VirtualHost>
</IfModule>

This basically tells Apache2 not to use keep-alive, use special SSL handling and generally downgrade to HTTP 1.0 standard whenever user-agent string in request has Trident word (matches IE11 and IE10 and possibly earlier IEs)

This added Connection: close HTTP header to each response and seemed to work fine locally.

On customers site this wasn't still working and produced the same Network error: 0x2ee4.

It may be worth noting that customer was using McAfee Web Gateway as forwarding proxy which stood in the middle of browser <-> server communication.

Long story short, I found out that the problem was in the following: when page loads there are multiple GET requests being sent to server to get the page, resources etc. Then after 10 seconds of using it (my webapp is single-page-application, so user may spend more than 10 minutes on same page) only GWT-RPC requests are being made to the server which are POST requests. And after a minute of using this page (I suspect 1 minute = keep-alive timeout of proxy server) these POST requests start randomly fail with 0x2ee4 network error.

After I implemented GWT-RPC retry functionality, I found out that after 30 seconds of retries simply ALL GWT-RPC requests fail with above error. Refreshing the page was solving this problem again for a minute or so and then same story happened.

So, I figured out that CRAPPY IE11 and IE10 are incorrectly handling combination of SSL, Keep-alive and POST requests. It seems that сrappy IE10 and IE11 simply can't renew keep-alive ssl connection using POST requests and only do this using GET requests. Please note that Chrome, Firefox and other normal browsers are handling this situation quite well. When inspecting how Firefox behaves in such situation in Firebug: it can be clearly seen that POST request is made, then it is shown as aborted for like 0.5s and then this it is shown as successful (I suspect that Firefox handles this specific situation and makes GET request to server itself to renew SSL keep-alive connection and then retries POST request)

So, to fix this problem in IE I simply implemented functionality which "pings" server with GET request every 5 seconds (be ready to experiment with this time since this is most probably related to customer's proxy keep-alive timeout).

This made it work (please note that above Apache2 configuration hack is not needed in this case)

I really hope that this will help people with similar issue and save their time

Resources used:

  1. IE Network Error 0x2ef3 question 1
  2. IE Network Error 0x2ef3 question 2
  3. IE Network Error 0x2ef3 question 3
  4. Awesome q&a on how to implement transparent GWT-RPC retry functionality

P.S. Will I report this IE10 and IE11 issue to Microsoft? - really I'm not eager spending 30+ minutes of my time reporting issue on commercial crappy IE browser issue after I've already spent more than a week of finding out the problem.

I insist on recommending Chrome or Firefox or other normal browser to customers as viable alternative and I still think that IE11 is not suited for modern websites with AJAX

这篇关于GWT-RPC和臭名昭着的零星“StatusCodeException:0”异常重访的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆