loadrunner 常见错误收集及解决方案

一. This Vuser already started a transaction with the same name, and has not yet processed the corresponding lr_end_transaction statement. 
在做性能测试的时候,有时候会遇到下面的错误:This Vuser already started a transaction with the same name, and has not yet processed the corresponding lr_end_transaction statement.

解释:就是脚本中有一个事物开始了,但是没有结束事物,此时loadrunner就会报错,因为开始和结束是一一对应的,谁也不能把它们拆开,拆开了就会报错。

异常再现:

     下列代码中,如果业务方法报了异常(Throw Exception),那么下面的if判断的代码不会被执行,而直接跳到catch子句里,那么已经开始的业务"searchItemList_man"就没有被结束,当你再次开始业务时,就会报错~

 1 public int action() throws Throwable {
 2             
 3         misc = DemoMan();
 4                 lr.start_transaction("demo_man");
 5         try {
 6             //业务方法  
 7             items = demoService.demoItemList(misc);
 8             if (items.isSuccess()) {
 9                 lr.end_transaction("demo_man",lr.PASS);
10 
11             } else {
12                 lr.end_transaction("demo_man",lr.FAIL);
13             }
14             demoMap.clear();
15             demoIdSet.clear();
16             demoStatusList.clear();
17         } catch (Exception e) {
18             
19                        
20             e.printStackTrace();
21         }
22 
23 
24         misc = null;
25         items = null;
26         return 0;
27     }//end of action

解决办法:  在catch字句里加上一个 事务结束代码,修改后的catch段代码如下:

catch (Exception e) {
			// TODO Auto-generated catch block
                        lr.end_transaction("demo_man",lr.FAIL);
			e.printStackTrace();
		}

 

二.Function two_way_comm_post_message / two_way_comm_post_message_ex failed错误  

在Controller里运行脚本,运行一段时间以后出现如下error messages。

1. Code - 60990 Error: Two Way Communication Error: Function two_way_comm_post_message / two_way_comm_post_message_ex failed.

2. Code - 29739 Error: Service client with id=1 failed to post a message, reason - communication error.

3. Code - 16895 Error: Failed to post xdr buffers data array by post_ex.

4. Code - 10343 Error: Communication error: Cannot send the message since reached the shared memory buffer max size.

问题诱因1:

共享内存缓存溢出,造成Controller和Load Generator之间通讯出现问题。 

解决方案:

修改两个配置文件。

1. $installation folder$\dat\channel_configure.dat

2. $installation folder$\launch_service\dat\channel_configure.dat

在这两个文件中的[general]部分下添加如下配置。

shared_memory_max_size=100 (修改共享内存为100MB,默认是50MB)

重新启动Controller,问题解决。

问题诱因2

  打开 controller中的 diagnostics菜单,点掉复选框.. 步骤如下图

1.

 

2. 点掉 Enable the following diagnostics 



3. 整理了一下 这个功能是干么滴:

   
当场景中打开 Diagnostics 菜单下 Web Page Diagnostics 功能后, 才能得到网页分析组图。

  • 通过该图, 可以对事务的组成进行抽丝剥茧的分析, 得到组成这个页面的每一个请求的时间分析, 进 一步了解响应时间中有关网络和服务器处理时间的分配关系。
  • 可以实现对网站的前端性能分析, 明确系统响应时间较长是由服务器端处理能力不足还是客户端链接 到服务器的网络消耗导致的。

 


三. Fatal Error -26000: Not enough memory (12320 bytes) for "new buffer in LrwSrvNetTaskIt 问题解决及lr脚本心得

  现象: 用loadrunner跑场景的时候报错:
       Action.c(28): Fatal Error -26000: Not enough memory (12320 bytes) for "new buffer in LrwSrvNetTaskItem::AllocSrvNetBuf". Aborting 的错误,

     同时任务管理器里mmdrv.exe 内存占用一直增大,最终mmdrv.exe崩溃. 网上有人认为是 lr的 emulation browser设置问题,最后发现系脚本问题,原脚本声明了好几个变量,而且都未使用:

 

 1 Action()
 2 {
 3 
 4          //返回的字符串
 5     char resp_txt[200] = {0};
 6     //写入流的数据
 7     long myfile;
 8     //当前日期时间
 9     long now;
10    .....
11    ......    
12 
13     return 0;
14 }

解决方法及总结:    

后将此三个变量注释之后问题解决.

结论:LR的脚本要注意内存的使用,尽量减少变量声明,对于char类型的变量要及时用free:即:

1  char * a;
2  free (a);

四. Failed to connect to server "router.pay.xxx.com:80": [10060] Connection timed out

原因:这个错误直接原因是压力机的请求无法及时的连接指定的服务器端口,一般认为要么是压力机自身端口数占用完毕,要么是被测服务器端口被占用完毕

解决方案:

   1. 压力机端:

    (1)修改压力机注册

尝试修改注册表中
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters里,有如下两个键值:
TcpTimedWaitDelay  --- 1
MaxUserPort  ----  65534
端口等待时间调小,最大可用端口调大

(2). 修改loadrunner的配置
分别修改VUGEN和 control 二者的run time setting中的请求超时时间Preferences 中点击Options 其中有三项的参数可以一次都修改了,
HTTP-request connect timeout              建议修改为1000
HTTP-request receieve timeout             建议修改为1000
Step download timeout                            建议修改为10000
Http Keep Alive time out            建议修改800

2. 在nginx 和 tomcat所在服务器上查看连接数是不是已满, 输入

   netstat -an | grep TIME_WAIT -wc   发现大约有19000个
看来确实有很多time_wait的连接啊!
1. 检查 /ext/sysctl.conf ,是不是有
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
这两项配置,都修改为1
 
五.Loadrunner 运行场景时:missing newline in XXX.dat 错误解决

原因: 如果遇到此错误,一般是使用了类型为FILE参数化且格式有误

解决:

需检查2个地方:

a. dat文件中有没有空白行;

b. 文档最后一行是否为空行

如不是空行,需敲回车键补上一个空行。

六 Registering web_reg_find highest severity level was "ERROR" 错误

   现象:
     运行lr脚本时候报错: 
  Action.c(13): Error -27216: Invalid argument (number 1)   [MsgId: MERR-27216]

  Action.c(13): Registering web_reg_find highest severity level was "ERROR"   [MsgId: MMSG-26389]

 原因:

      报这个错一般都是lr的参数传递格式有误:

  1. 变量与等号间有空格 如 a = 0,被认为无效。

  2. 参数之间缺少正确的分隔符","

 

 

posted on 2014-03-24 16:30  babyblue  阅读(1940)  评论(0)    收藏  举报