NetConnection.Call.Failed 在 Flex3/Tomcat/BlazeDS/Spring 中偶尔发生

发布于 2024-09-07 13:00:08 字数 4148 浏览 4 评论 0原文

我有一个很大的问题。我使用 Flex3/Tomcat/BlazeDS/Spring 编写了一个大型应用程序,该应用程序在本地开发时运行良好,在部署到公共开发环境时运行良好,但在部署到我们的测试环境时经常失败。

当远程处理请求花费大量时间(超过 20 秒)时,失败似乎最容易发生。在我的开发服务器上,错误发生,但仅当请求花费很长时间(超过 45 秒)时才会发生。但是,该错误有时也会看似立即发生(发送请求,但立即失败)。大多数错误还带有 HTTP 状态:502(网关错误),但有些错误只是显示 HTTP 失败。

除了将 war 文件放在 webapps 目录中之外,我没有对 BlazeDS 进行任何特殊操作。该应用程序通过 https 访问。远程调用仅通过“目的地”引用服务器。我们的 DEV 和 TEST 实例上的 tomcat 服务器具有相同的 java 参数(相同的 Xms 和 Xmx 等)。以下是我的相关文件:

services-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<services-config>
    <services>
        <default-channels>
           <channel ref="my-secure-amf"/>
        </default-channels>
    </services>
    <channels>
        <channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel">
            <endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>
            <properties>
                <add-no-cache-headers>false</add-no-cache-headers>
            </properties>
        </channel-definition>
    </channels>
<services-config>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    ...

    <servlet>
        <servlet-name>spring-flex</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/flexContext.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>spring-flex</servlet-name>
        <url-pattern>/messagebroker/*</url-pattern>
    </servlet-mapping>
</web-app>

flexContext.xml

<!--
    I have component-scan tags here to scan my class files. The Controller I'm using for flex has an annotation on it to define it as a remote destination. Here it is:
    @Controller
    @RemotingDestination(value = "dest", channels="my-secure-amf")
    public class FlexController {
-->

<bean id="flexExceptionTranslator" class="edu.liberty.zconduct.web.FlexExceptionTranslator" />

<flex:message-broker>
    <flex:exception-translator ref="flexExceptionTranslator"/>
    <!-- <flex:secured /> Had this previously, but it wasn't working then, either -->
</flex:message-broker>

我已经束手无策了。该错误是一个应用程序破坏者。如果可以的话请帮助我。

编辑 我切换到http,仍然出现错误。 Tomcat 现在说:

警告:发送结束数据包时出错

java.net.SocketException:管道损坏

我在 apache 日志中查找 jk_mod 并看到一些类似于我发送的请求的调试信息,然后是以下内容:

[调试] ajp_send_request::jk_ajp_common.c (1592):重新发送请求正文(432)

[调试] jk_shutdown_socket::jk_connect.c (681): 即将关闭套接字 68

[调试] jk_shutdown_socket::jk_connect.c (732): 关闭套接字 68 并读取 0 延迟字节

[信息] ajp_connection_tcp_get_message::jk_ajp_common.c (1150): (myTestServer) 无法接收 响应头消息来自 tomcat,网络问题还是tomcat (xx.xx.xx.xx:xxxx) 已关闭 (errno=11)

[错误] ajp_get_reply::jk_ajp_common.c (1962): (myTestServer) Tomcat 已关闭 或拒绝连接。没有任何回应 已发送给客户(尚未)

[信息] ajp_service::jk_ajp_common.c (2447):(myTestServer)发送请求 tomcat失败(可恢复), (尝试=2)

[错误] ajp_service::jk_ajp_common.c (2466):(myTestServer)连接到 tomcat 失败。

[调试] ajp_reset_endpoint::jk_ajp_common.c (743): (myTestServer) 重置 端点 sd = 4294967295(套接字 关闭)

[调试] ajp_done::jk_ajp_common.c (2905):回收连接池 工作人员 myTestServer 的 slot=0

[信息] jk_handler::mod_jk.c (2615): 服务错误=0 工人=myTestServer

I have a very large problem. I've written a large app using Flex3/Tomcat/BlazeDS/Spring that has worked very well while developing locally, fine when I deployed to a common dev environment, but then fails very often when deployed to our test environment.

The failures seem to happen most when a remoting request takes a good bit of time (more than 20 seconds). On my dev server, the errors happen, but only when the request takes a very long time (more than 45 seconds). However, the error also occurs seemingly instantly at times (send a request and it fails immediately). Most of the errors also have HTTP Status: 502 on them (Bad Gateway), but some just say HTTP Failed.

I haven't done anything special with BlazeDS other than put the war file in the webapps directory. The application is accessed over https. Remoting calls refer to the server by "destination" only. The tomcat servers on our DEV and TEST instances have identical java arguments (same Xms and Xmx, etc). Below are my relevant files:

services-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<services-config>
    <services>
        <default-channels>
           <channel ref="my-secure-amf"/>
        </default-channels>
    </services>
    <channels>
        <channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel">
            <endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>
            <properties>
                <add-no-cache-headers>false</add-no-cache-headers>
            </properties>
        </channel-definition>
    </channels>
<services-config>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    ...

    <servlet>
        <servlet-name>spring-flex</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/flexContext.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>spring-flex</servlet-name>
        <url-pattern>/messagebroker/*</url-pattern>
    </servlet-mapping>
</web-app>

flexContext.xml

<!--
    I have component-scan tags here to scan my class files. The Controller I'm using for flex has an annotation on it to define it as a remote destination. Here it is:
    @Controller
    @RemotingDestination(value = "dest", channels="my-secure-amf")
    public class FlexController {
-->

<bean id="flexExceptionTranslator" class="edu.liberty.zconduct.web.FlexExceptionTranslator" />

<flex:message-broker>
    <flex:exception-translator ref="flexExceptionTranslator"/>
    <!-- <flex:secured /> Had this previously, but it wasn't working then, either -->
</flex:message-broker>

I'm near the end of my rope. The error is an app-breaker. Please, please help me if you can.

EDIT
I switched over to http and still get the error. Tomcat is now saying:

WARNING: Error sending end packet

java.net.SocketException: Broken pipe

I look in my apache log for jk_mod and see some debug information that looks like the request I sent in, and then the following:

[debug]
ajp_send_request::jk_ajp_common.c
(1592): Resent the request body (432)

[debug]
jk_shutdown_socket::jk_connect.c
(681): About to shutdown socket 68

[debug]
jk_shutdown_socket::jk_connect.c
(732): Shutdown socket 68 and read 0
lingering bytes

[info]
ajp_connection_tcp_get_message::jk_ajp_common.c
(1150): (myTestServer) can't receive
the response header message from
tomcat, network problems or tomcat
(xx.xx.xx.xx:xxxx) is down (errno=11)

[error] ajp_get_reply::jk_ajp_common.c
(1962): (myTestServer) Tomcat is down
or refused connection. No response has
been sent to the client (yet)

[info] ajp_service::jk_ajp_common.c
(2447): (myTestServer) sending request
to tomcat failed (recoverable),
(attempt=2)

[error] ajp_service::jk_ajp_common.c
(2466): (myTestServer) connecting to
tomcat failed.

[debug]
ajp_reset_endpoint::jk_ajp_common.c
(743): (myTestServer) resetting
endpoint with sd = 4294967295 (socket
shutdown)

[debug] ajp_done::jk_ajp_common.c
(2905): recycling connection pool
slot=0 for worker myTestServer

[info] jk_handler::mod_jk.c (2615):
Service error=0 for
worker=myTestServer

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

软糯酥胸 2024-09-14 13:00:08

Cornel Creanga 帮助我找到了这个解决方案。我将应用程序切换到 http 并开始接收 catalina.out 文件中的消息。我不知道为什么这会影响它,但确实如此。这些消息都说套接字中的管道损坏了。进一步调查发现涉及到jk_mod。

通过大量搜索,我发现我们的系统管理员在测试服务器上将服务器上的套接字超时设置为 10 秒,但在开发服务器上设置为 5 分钟,因此正在进行的大量搜索导致测试服务器超时。

系统管理员调整了 TEST 上的配置,以便另一个工作人员(有 5 分钟超时)处理对此上下文路径的调用。

Cornel Creanga helped me arrive at this solution. I switched my app to http and started receiving messages in the catalina.out file. I don't know why this affected it, but it did. The messages all said that there was a broken pipe in the socket. Further investigation showed that the jk_mod was involved.

Through much searching, I discovered that our SysAdmins had set the socket timeout on the server to 10 seconds on our TEST servers, but 5 minutes on our DEV servers, so the massive searches being done were causing it to time out once it got to TEST.

The SysAdmins adjusted the configuration on TEST so that another worker (with a 5 minute timeout) handles the calls for this context path.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文