并发测试中遇到的一个问题
在做50个用户并发操作下载文件,通过Http方式,并保存到本地路径。执行场景的时候,出现以下的错误:
Action.c(48): Error: C interpreter run time error: Action.c (48):Error -- memory violation : Exception ACCESS_VIOLATION received.
请教各位大虾,可能是什么原因? http://bbs.51testing.com/viewthread.php?tid=172428&highlight=ACCESS%5C_VIOLATION%2B希望有帮助 回复 2# baikunhu
谢谢...~~
我的问题是脚本完成后回放、调试和运行都是正常,可是加入场景后,并发多个用户(实验中是50个),执行场景,运行结果显示极少数运行成功,其他失败的原因就是上述的错误信息。
具体代码如下:
#include "web_api.h"
Action()
{
int flen,rNum; //定义一个整型变量保存获得文件的大小
long filedes; //保存文件句柄
char filepath,filename;//保存文件路径及文件名
rNum = rand() % 10000000;//生成一个随机的文件全路径名
itoa(rNum, filename, 10);
strcpy(filepath,"D:\\File\\");//假如下载的文件保存到F盘的Flie文件夹下
strcat(filepath,filename);
strcat(filepath,".zip");//下载文件的后缀名
web_url("lus",
"URL=http://10.27.146.118:6020/sec/lus",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
EXTRARES,
"Url=struts/ext/resources/css/ext-all.css", "Referer=http://10.27.146.118:6020/sec/lus/preUserLogin.do", ENDITEM,
"Url=struts/tags/js/ext-tag-lang-zh_CN.js", "Referer=http://10.27.146.118:6020/sec/lus/preUserLogin.do", ENDITEM,
"Url=lus/images/login.png", "Referer=http://10.27.146.118:6020/sec/lus/preUserLogin.do", ENDITEM,
"Url=struts/ext/resources/images/default/button/btn-sprite.gif", "Referer=http://10.27.146.118:6020/sec/lus/preUserLogin.do", ENDITEM,
"Url=struts/ext/resources/images/default/form/text-bg.gif", "Referer=http://10.27.146.118:6020/sec/lus/preUserLogin.do", ENDITEM,
"Url=struts/ext/resources/images/default/qtip/tip-sprite.gif", "Referer=http://10.27.146.118:6020/sec/lus/preUserLogin.do", ENDITEM,
LAST);
web_url("autoDownload.action",
"URL=http://10.27.146.118:6020/sec/autoDownload.action?LAC=WD-WMAM9U&ESN=WD-WMAM9UV67594&productName=USG5320&productVersion=V100R003&modeName=UTMFWE04",
"Resource=0",
"RecContentType=text/xml",
"Referer=",
"Snapshot=t2.inf",
"Mode=HTML",
EXTRARES,
LAST);
lr_rendezvous("所有下载用户到达集合点");
lr_start_transaction("HTTP下载特征库");
web_set_max_html_param_len("90000000");
web_reg_save_param("fcontent","LB=","RB=","SEARCH=BODY",LAST);
web_url("Download",
"Url=http://10.27.146.118:6020/SignatureDownload/LUS_AV_S1_1285488600037.zip",
"Referer=",
EXTRARES,
LAST);
flen = web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE); //获得文件大小
if(flen > 0)
{
if((filedes = fopen(filepath, "wb")) == NULL)
{
lr_output_message("Open File Failed!");
return -1;
}
fwrite( lr_eval_string("{fcontent}"),flen,1,filedes );/*把关联的数据写入文件*/
fclose( filedes );/* 关闭文件流 */
}
lr_end_transaction("HTTP下载特征库",LR_AUTO);
return 0;
} 把数组改成指针看看。
另外再看看这两个
http://bbs.51testing.com/viewthread.php?tid=122638&highlight=Exception%2BACCESS%5C_VIOLATION%2Breceived
http://bbs.51testing.com/viewthread.php?tid=181719&highlight=Exception%2BACCESS%5C_VIOLATION%2Breceived 关注ing...,记得去年也曾遇到过类似的错误 回复 4# baikunhu
试着把数组改成指针的话,在回放运行脚本的时候就会报这个错误了。 web_reg_save_param("fcontent","LB=","RB=","SEARCH=BODY",LAST);
会不会是这个函数的使用问题?
页:
[1]