精华内容
下载资源
问答
  • If the issue was caused after making changes in application, check what exactly has changed since it was working previously? Was something upgraded? Added? Pointing to a new database or other ...

    Environment

    • Red Hat JBoss Enterprise Application Platform (EAP)
      • 6.x
      • 7.x

    Issue

    • Server throws following error while start up :
    Raw
    12:21:13,956 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS013412: Timeout after [300] seconds waiting for service container stability. Operation will roll back. Step that first updated the service container was 'add' at address '[("interface" => "management")]'
    
    • There are pretty big applications running on server and it may take 5-6 min to start the servers. So how to set the timeout to 600 or 900 seconds ? Where and how to set it ?

    • Slave JBoss EAP instance won't start when application code takes too long to load.

    • We are coming across this bug mentioned in  https://bugzilla.redhat.com/show_bug.cgi?id=1117945 and were wondering if it has been fixed in 6.3.3 or the up-coming 6.4.

    • When trying to deploy a new version of our application I get the following error. ” Operation timeout awaiting service container stability" typically the application will deploy pretty quick. Now it waits until it times out, What could be causing this problem?

    • Jboss application server is not able to restart after throwing the below error. We had this issue in of our servers in the past, so had set this property, looks like the server is waiting 600 seconds for the deployment to happen and failing after that. Could you please advice us on what the issue could be, as our QA environment is down at this moment?

    Raw
    02:30:20,757 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS013412: Timeout after [600] seconds waiting for service container stability. Operation will roll back. Step that first updated the service container was 'add' at address '[
        ("core-service" => "management"),
        ("management-interface" => "native-interface")
    ]'
    
    • We run jboss on a rather underpowered VM for test purposes,sometimes it can take a long time to start, and then times out.Is it possible to extend the timeout?
    • Unable to deploy WAR file on AWS VM
    • When we start the JBOSSEAP6 windows service, the deployment produces a ".failed" file in the deployments folder, rather than a ".deployment" file.  This is a newly-created AWS EC2 Windows Server 2012 R@  instance - a test environment for now and issue comes every time we try to start the JBoss service.

    Resolution

    In EAP 7.x and EAP 6.3.0 or later, you can configure  jboss.as.management.blocking.timeout system property to tune timeout (seconds) waiting for service container stability.

    For standalone mode :

    • Use following CLI command to set jboss.as.management.blocking.timeout. For example:

      Raw
      /system-property=jboss.as.management.blocking.timeout:add(value=600)
      

      the above will set jboss.as.management.blocking.timeout system property in configuration file (i.e standalone-*.xml) like :

      Raw
      ...
      </extensions>
      <system-properties>
            <property name="jboss.as.management.blocking.timeout" value="600"/> 
      </system-properties>
      <management>
      ...
      

    or

    • Add -Djboss.as.management.blocking.timeout=600 to jvm argument of standalone.sh or add the following JAVA_OPTS in standalone.conf:

      Raw
      JAVA_OPTS="$JAVA_OPTS -Djboss.as.management.blocking.timeout=600"
      

    For domain mode :

    • Edit the $JBOSS_HOME/bin/domain.conf and set it via this line -Djboss.as.management.blocking.timeout=600 after the if block:
    Raw
    ...
    #
    # Specify options to pass to the Java VM. 
    #
    if [ "x$JAVA_OPTS" = "x" ]; then
       JAVA_OPTS="-Xms64m -Xmx512m -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true"
       JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=$JBOSS_MODULES_SYSTEM_PKGS -Djava.awt.headless=true"
    else
       echo "JAVA_OPTS already set in environment; overriding default settings with values: $JAVA_OPTS"
    fi
    
    JAVA_OPTS="$JAVA_OPTS -Djboss.as.management.blocking.timeout=600"
    ...
    

    Note: The only use case for setting a property at the server-group or individual domain server level would be if you wanted a lower timeout than what you configure on the host controllers.

    Root Cause

    • In EAP 6.3.0.ER8  there is a new class in jboss.as.controller: BlockingTimeout. This class loads the value of system property jboss.as.management.blocking.timeout or defaults to 300 (seconds). Note:  This property is not a timeout per deployment but a timeout on container stability and if jboss.as.management.blocking.timeout is reached during startup then all applications will be undeployed and the container shutdown.  The reasoning behind this is that having a half-working server is potentially dangerous as you may not notice major failures.

    Diagnostic Steps

    • Confirm whether a virus scanner is installed to the server
    • If the issue  was caused after making changes in application, check what exactly has changed since it was working previously?  Was something upgraded?  Added?  Pointing to a new database or other external system?
    • Collect a series of thread dumps during your startup period so we can see what it might be getting stuck on. 
    • Make sure to add the setting to the domain.conf on the Domain controller  and  Slave Host controller

    Once you  collect we can analyse them and to see whether there is some sort of deadlock or resource that your threads are waiting on that's preventing them from completing the deployment etc.

     

     

     

    Symptoms

    When starting JBoss, the following error is printed in application server log:

    ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS013412: Timeout after [300] seconds waiting for service container stability. Operation will roll back. Step that first updated the service container was 'add' at address '[
    ("core-service" => "management"),
    ("management-interface" => "native-interface")
    ]'
    

    JBoss then fails to deploy.

    Cause

    This error message is printed out when the management-native socket defined in standalone.xml located in <JBOSS_HOME>/standalone/configuration takes longer than the configured timeout value to load. By default, this value is set to 300 seconds.

    Action

    1. Open standalone.conf (Unix) or standalone.conf.bat (Windows) located in <JBOSS_HOME>/bin and verify the following timeout value is large enough:

      JAVA_OPTS="$JAVA_OPTS -Djboss.as.management.blocking.timeout=3600" 
      
    2. Open standalone.xml and modify the default-timeout property in the coordinator-environment element to a larger value (e.g., 1000):

      <coordinator-environment default-timeout="..."/>
      

    Note: In case the changes are not applied, clear the JBoss cache by deleting the following folders:

    • <JBOSS_HOME>/standalone/data
    • <JBOSS_HOME>/standalone/tmp

    Affected Versions

    This article applies to all versions of Appian using JBoss as an application server.

    Last Reviewed: February 2017

    展开全文
  • 数据库连接超时问题

    千次阅读 2019-06-19 17:02:48
     如果数据库连接空闲时间大于wait_timeout,则操作web应用就会出现上述异常,解决办法可以设置wait_timeout的时间为一个适合实际应用场景的时间。设置命令为: set global wait_timeout=28800;  时间单位...

    问题:

    com.alibaba.druid.pool.DruidDataSource - discard connection
    com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
    The last packet successfully received from the server was 109,470 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago.

    java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.

    原因分析:

    数据库连接强行断开,但是web应用不知道数据库已经断开(或者理解为连接池子不知道数据库已经断开),还是通过连接池子连接数据库与数据库的交互,这样会导致如上错误。

    解决方案:

    1.查询mysql数据库的非交互式最大等待时间wait_timeout

       一般数据库默认的wait_timeout为8小时。查询wait_timeout的命令如下:

    mysql> show global variables like 'wait_timeout'; 

      如果数据库连接空闲时间大于wait_timeout,则操作web应用就会出现上述异常,解决办法可以设置wait_timeout的时间为一个适合实际应用场景的时间。设置命令为:

    set global wait_timeout=28800;  

           时间单位为ms,但是wait_timeout设置页不要太大,如果太大会导致数据库连接打开时间过长,在show processlist时,看到很多sleep状态的连接,从而造成too many connections错误;如果wait_timeout设置太小的话会导致连接关闭很快,从而使一些预设置的连接不起作用。

     2.在确认1步骤wait_timeout配置没有问题的话,查看数据库配置设置是否有问题

        dbcp的参数设置意义

        参考连接:http://commons.apache.org/proper/commons-dbcp/configuration.html

    字段名称设置值说明
    initialSize5初始化连接:连接池启动时创建的初始化连接数据量
    maxActive20最大活动连接:连接池在同一时间能够分配的最大活动连接的数量,如果设置为非正数则表示不限制
    maxIdle10最大空闲连接:连接池中容许保持空闲状态的最大连接数量,超过的空闲连接将被释放,如果设置为负数表示不限制
    minIdle2最小空闲连接数:当数据库连接池的空闲数少于这个数目的时候,数据库自动创建空闲连接,当设置为0的时候,不创建空闲连接
    maxWait1800最大等待时间:当没有可用连接时,连接池等待连接被归还的最大时间(以毫秒计数),超过时间则抛出异常,如果设置为-1则无限等待
    minEvictableIdleTimeMillis300000连接池中的空闲连接保持空闲不被空闲连接回收器线程回收的最小时间值,单位毫秒
    timeBetweenEvictionRunsMillis120000空闲连接回收器线程休眠的时间值,即每隔这个时间值空闲连接回收器线程回收空闲连接,单位毫秒
    numTestsPerEvictionRun3每次空闲连接回收器线程线程运行的时候检查的连接数量
    validationQueryselect 1

    在把连接返回给调用者之间,SQL查询,用来验证从连接池子取出连接,是一个用来检测连接是否有效的SQL,要求是一个查询语句,如果

    validationQuery为null,testWhileIdle、testOnBorrow、testOnReturn都不起作用

    testWhileIdletrue建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。
    testOnBorrowfalse是否在从池中取出连接前进行检验,如果检验失败,则从池中去除连接并尝试取出另一个.申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。
    testOnReturnfalse归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。
    username/数据库连接的用户名
    password/数据库连接的密码
    url/数据库连接的url
    driverClassName/

    数据库连接的驱动类的类名,例如

    com.mysql.jdbc.Driver

         2.1通过设置

         <property name="validationQuery" value="select 1" />

                数据库每次执行sql会额外执行一条提供的validationQuery sql,来减少出现文章中提到的错误问题。

         2.2通过配置timeBetweenEvictionRunsMillis和minEvictableIdleTimeMillis

               如果timeBetweenEvictionRunsMillis大于0,每过 timeBetweenEvictionRunsMillis毫秒Evictor会调用evict()方法,检查连接池中的连接的闲置时间是否大于 minEvictableIdleTimeMillis毫秒,是则销毁此对象,然后调用ensureMinIdle方法检查确保池中对象个数不小于_minIdle。如果连接池的连接数小于最小空闲连接数,则创建数据库连接,同时检查连接池的连接是否小于maxIdle,是则把刚创建的连接放入连接池中,否则销毁此对象。

              数据库在重启后minEvictableIdleTimeMillis前访问web应用,数据库连接池子连接的是老的连接,所以会出现文章中提到的问题。这时可以设置minEvictableIdleTimeMillis的大小要小于mysql的wait_timeout时间,并且minEvictableIdleTimeMillis的值不要设置太小,太小的话会增加系统开销。timeBetweenEvictionRunsMillis和minEvictableIdleTimeMillis时间可以适当调整,具体以实际情况为准。

         2.3JDBC配置mysql连接url的重连机制

              在数据库的连接url中增加数据库自动重连接机制autoReconnect=true         

        

     

    展开全文
  • mysql数据库连接超时

    2018-04-23 10:45:37
    连接数据库超时设置autoReconnect=true* 问题现象:```bashCaused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 21,582,820,423 ...

    连接数据库超时设置autoReconnect=true

    * 问题现象:

    ```bash

    Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 21,582,820,423 milliseconds ago

    .  The last packet sent successfully to the server was 21,582,820,425 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You sho

    uld consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, 

    or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.

    ```

    * 解决办法:

    在mysql的连接URL中增加:autoReconnect=true&failOverReadOnly=false 两个配置

    需要注意:如果是在XML里面配置,“&”需要替换成“&amp;”

    * 常用mysql的URL参数参考:

    参数名称参数说明缺省值最低版本要求
    user数据库用户名(用于连接数据库) 所有版本
    password用户密码(用于连接数据库) 所有版本
    useUnicode是否使用Unicode字符集,如果参数characterEncoding设置为gb2312或gbk,本参数值必须设置为truefalse1.1g
    characterEncoding当useUnicode设置为true时,指定字符编码。比如可设置为gb2312或gbkfalse1.1g
    autoReconnect当数据库连接异常中断时,是否自动重新连接?false1.1
    autoReconnectForPools是否使用针对数据库连接池的重连策略false3.1.3
    failOverReadOnly自动重连成功后,连接是否设置为只读?true3.0.12
    maxReconnectsautoReconnect设置为true时,重试连接的次数31.1
    initialTimeoutautoReconnect设置为true时,两次重连之间的时间间隔,单位:秒21.1
    connectTimeout和数据库服务器建立socket连接时的超时,单位:毫秒。 0表示永不超时,适用于JDK 1.4及更高版本03.0.1
    socketTimeoutsocket操作(读写)超时,单位:毫秒。 0表示永不超时03.0.1
    展开全文
  • 数据库连接超时

    2017-11-12 20:26:00
    http://zeusami.iteye.com/blog/1112827 MySQL第二天早上第一次连接超时报错,解决方法com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure com.mysql.jdbc.exceptions.jd...

    http://zeusami.iteye.com/blog/1112827



    MySQL第二天早上第一次连接超时报错,解决方法com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure 

    com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure Last packet sent to the server was 0 ms ago 



    最近碰到一个mysql5数据库的问题。就是一个标准的servlet/tomcat网络应用,后台使用mysql数据库。问题是待机一晚上后,第二天早上第一次登录总是失败。察看日志发现如下错误: 

    “com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure 

    Last packet sent to the server was 0 ms ago.” 


    经过一番调研,发现很多人都碰到过类似问题,但网上令人满意的回答并不多。mysql网站上的提问也很多,但并没有正确答案;百度知道上倒是有一个近似正确的回答。现将本人的解决办法总结一下: 

    上述问题是由mysql5数据库的配置引起的。mysql5将其连接的等待时间(wait_timeout)缺省为8小时。在其客户程序中可以这样来查看其值: 

    mysql﹥ 

    mysql﹥ show global variables like 'wait_timeout'; 

    +---------------+---------+ 

    | Variable_name | Value | 

    +---------------+---------+ 

    | wait_timeout | 28800 | 

    +---------------+---------+ 

    1 row in set (0.00 sec) 


    28800 seconds,也就是8小时。 

    如果在wait_timeout秒期间内,数据库连接(java.sql.Connection)一直处于等待状态,mysql5就将该连接关闭。这时,你的Java应用的连接池仍然合法地持有该连接的引用。当用该连接来进行数据库操作时,就碰到上述错误。这解释了为什么我的程序第二天不能登录 的问题。 

    你可能会想到在tomcat的数据源配置中有没有办法解决?的确,在jdbc连接url的配置中,你可以附上“autoReconnect=true”,但这仅对mysql5以前的版本起作用。增加“validation query”似乎也无济于事。 

    本人觉得最简单的办法,就是对症下药:既然问题是由mysql5的全局变量wait_timeout的缺省值太小引起的,我们将其改大就好了。 

    查看mysql5的手册,发现对wait_timeout的最大值分别是24天/365天(windows/linux)。以windows为 例,假设我们要将其设为21天,我们只要修改mysql5的配置文件“my.ini”(mysql5 installation dir),增加一行:wait_timeout=1814400 

    需要重新启动mysql5。 

    linux系统配置文件:/etc/my.cnf 

    测试显示问题解决了。 


    也可以直接设置 

    mysql修改wait_timeout 

    mysql mysql> show global variables like 'wait_timeout'; 

    其默认值为8小时 

    mysql的一个connection空闲时间超过8小时,mysql会自动断开该连接。 

    1.修改配置 

    vi /etc/my.cnf 

    [mysqld] wait_timeout=10 

    # /etc/init.d/mysql restart 

    2.直接用sql命令行修改 mysql> set global wait_timeout=604800; 

    除了wait_timeout,还有一个'interactive_timeout' 

    同样可以执行SHOW GLOBAL VARIABLES LIKE 'interactive_timeout'来查询 
    执行set global interactive_timeout=604800;来设置 



    本文转自 蔡小赵 51CTO博客,原文链接:http://blog.51cto.com/zhaopeiyan/1949790

    展开全文
  • MySql数据库连接超时处理

    万次阅读 2015-12-22 08:55:33
    欢迎支持笔者新作:《深入理解Kafka:核心设计与...博主在做web开发时遇到MySql数据库连接超时的问题。 控制台报错如下: Request processing failed; nested exception is org.springframework.transaction.Canno...
  • 查了数据库连接数为1000, 当前连接数400左右: select count(*) from v$session; --当前连接数 select value from v$parameter where name = 'processes'; --数据库连接数 该应用的最大连...
  • mysql 数据库连接超时总结 如何设置mysql 数据库连接超时 当mysql 8小时空闲后会出现连接超时问题,本文介绍要解决这个问题也有一个简单的方法,就是修改mysql的启动参数。缺省情况下mysql的timeout时间是28800秒...
  • 由于大数据量导出导致操作数据库时间超过了30秒,导致连接被关闭了;出现这种问题可以将连接数据库的设置修改一下: maximumActiveTime 设置到 900000 然后下面又报了这个错:ERROR Could not togg...
  • mysql 数据库连接超时

    2016-11-03 17:30:28
    声明:本博文用于学习总结及工作心得 进行数据库插入操作时,发现与该表关联的另一张表,出现数据库连接超时 根据Tomcat日志返回的信息,大致描述为: org.hibernate.exception.JDBCConnectionException: could not ...
  • 产生的原因:应用方的数据库连接有效期时间,大于数据库自己设置的有效期。 解决方案: 一、修改druid配置(如果使用druid的话) 1 2 3 4 spring.datasource.druid.validationQuery...
  • 数据库连接超时异常

    2013-10-22 17:49:00
    The last packet successfully received from the server was 32,399,735 milliseconds ago. The last packet sent successfully to the server was 0 m...
  • MySQL服务器默认的“wait_timeout”是28800秒即8小时,意味着如果一个连接的空闲时间超过8个小时,MySQL自动断开该 连接,而连接池却认为该连接还是有效的(因为并未校验连接的有效性),当应用申请使用该连接时,就...
  • 最近碰到一个mysql5数据库的问题。就是一个标准的servlet/tomcat网络应用,后台使用mysql数据库。问题是待机一晚上后,第二天早上第一次登录总是失败。察看日志发现如下错误: ...
  • MySQL数据库连接超时自动断开的解决方案最近在将本地的JavaWeb项目部署到服务器上之后遇到的一个奇怪问题在部署完成后,网站当时可以正常工作,但是第二天访问网站的时候却会遇到一个500 Server Error。Tomcat 的...
  • 必须确保你的druid jdbc版本为1.2.6 这个问题只有在druid 1.2.6里解决,因为只要是低于druid 1.2.6版本,本身就存在bug,无论你怎么设都会打断...这个很正常,那是因为:MYSQL不可能无限接在接受一个数据库连接请求
  • 操作系统 Windows 10 ...关于针对数据库连接,之前没有特别注意过,直到遇到如下问题: Could not open JDBC Connection for transaction; nested exception is com.mysql.jdbc.exceptions.jdbc4.Communication
  • 最近碰到一个mysql5数据库的问题。就是一个标准的servlet/tomcat网络应用,后台使用mysql数据库。问题是待机一晚上后,第二天早上第一次登录总是失败。察看日志发现如下错误: ...
  • 产生的原因:应用方的数据库连接有效期时间,大于数据库自己设置的有效期。 解决方案: 一、修改druid配置(如果使用druid的话) spring.datasource.druid.validationQuery=select 1 spring.datasource....
  • 在长时间导出数据时,经常看到一个错误,但是没怎么影响程序,就一直没管,今天就把它揪出来 [WARN] #0001 was active for 315435 milliseconds and has been removed automaticaly. The Thread responsible was ...
  • 数据库连接超时的问题

    千次阅读 2012-07-10 12:03:13
    com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was43810 seconds ago.The last packet sent success fully to the server was 43810 seconds a
  • mysql5数据库连接超时问题的解决办法 最近碰到一个mysql5数据库的问题。就是一个标准的servlet/tomcat网络应用,后台使用mysql数据库。问题是待机一晚上后,第二天早上第一次登录总是失败。察看日志发现如下错误: ...
  • 文章目录1.报错2.原因3.解决 1.报错 Caused by: ... The last packet sent successfully to the server was 56,766,428 milliseconds ag
  • 即两个小时内没有连接的话,服务器会断掉连接。等这时有请求过来的话,请求池会分配一中断的连接,于是报了如上的异常。 经搜索可以在连接池中添加一些额外的配置来避免此问题,如DBCP: <!-- 配置间隔多久才...
  • Mysql5数据库连接超时问题

    千次阅读 2010-12-22 18:06:00
    问题描述:系统本来运行正常,但过一段时间,或待机一晚上后,第二天早上第一次登录总是失败。查看日志或Tomcat控制台输出,发现如下错误信息: Cause: ...
  • 想必大家在用MySQL时都会遇到连接超时的问题,如下图所示:     就是这个异常(com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:Communications link failure Last packet sent to the server was X ...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 10,715
精华内容 4,286
关键字:

was数据库连接超时时间