langu0823 发表于 2013-8-5 10:24:58

loadrunner链接mysql数据库后,controller中脚本运行4小时后报错,虚拟用户停止运行

报错信息:
1、F:\\Program Files\\HP\\LoadRunner\\include/Ptt_Mysql.h(75): Error: C interpreter run time error: F:\\Program Files\\HP\\LoadRunner\\include/Ptt_Mysql.h (75):Error -- memory violation : Exception ACCESS_VIOLATION received.

2、Abnormal termination, caused by mdrv process termination.
我的脚本如下:

#include "Ptt_Mysql.h"

#define MYSQLSERVER "192.168.1.139"
#define MYSQLUSERNAME "itsm"
#define MYSQLPASSWORD "123444"
#define MYSQLDB    "xt"
#define MYSQLPORT 9906

MYSQL *Mconn;

vuser_init()
{
    lr_load_dll("libmysql.dll");
    Mconn=lr_mysql_connect(MYSQLSERVER, MYSQLUSERNAME, MYSQLPASSWORD, MYSQLDB, MYSQLPORT);

        return 0;
}
Action()
{

char chQuery;
        char x;
        char y;
   
        strcpy(y,lr_eval_string ("{userID}"));
        strcpy(x,"SELECT bpi.ID AS PROCESS_INSTANCE_ID,FORM_INSTANCE_IDFROM BPM_PROCESS_INSTANCE bpi INNER JOIN FM_FORM_VERSION ffv ON ffv.ID = bpi.FORM_VERSION_ID INNER JOIN FM_FORM ff ON ff.ID = ffv.FORM_IDINNER JOIN SF_SERVICE_CATEGORY ssc ON ssc.ID=ff.SERVICE_CATEGORY_ID INNER JOIN ( SELECT bnh.PROCESS_INSTANCE_ID piid,bnh.ROLE_BY_AREA_FLAG FROM BPM_NODE_HISTORY bnh WHERE bnh.RUN_FLAG = '1' AND bnh.IMPLEMENTER_ID =");
        strcat(x,y);
        strcat(x," UNION SELECT bnh.PROCESS_INSTANCE_ID piid,bnh.ROLE_BY_AREA_FLAG FROM BPM_NODE_HISTORY bnh WHERE bnh.IMPLEMENT_ROLE_TYPE = 'GROUP_ROLE' AND bnh.RUN_FLAG = '1' AND (IMPLEMENTER_ID IS NULL OR IMPLEMENTER_ID='')AND bnh.IMPLEMENT_GROUP_ID IN ( SELECT GROUP_ID FROM SYS_GROUP_USER sgu,SYS_USER su WHERE sgu.USER_ID =");
        strcat(x,y);
        strcat(x," AND sgu.USER_ID = su.ID AND su.PAUSE_ORDERS =");
        strcat(x,y);
        strcat(x,") UNION SELECT bnh.PROCESS_INSTANCE_ID piid,bnh.ROLE_BY_AREA_FLAG FROM BPM_NODE_HISTORY bnh WHERE bnh.IMPLEMENT_ROLE_TYPE = 'SYSTEM_ROLE' AND bnh.RUN_FLAG = '1' AND (IMPLEMENTER_ID IS NULL OR IMPLEMENTER_ID='')AND bnh.IMPLEMENT_GROUP_ID IN ( SELECT ROLE_ID FROM SYS_USER_ROLE syr,SYS_USER su WHERE syr.USER_ID =");
        strcat(x,y);
        strcat(x," AND syr.USER_ID = su.ID AND su.PAUSE_ORDERS = ");
        strcat(x,y);
        strcat(x,") UNION SELECT bnh.PROCESS_INSTANCE_ID piid,bnh.ROLE_BY_AREA_FLAG FROM BPM_NODE_HISTORY bnh WHERE bnh.IMPLEMENT_ROLE_TYPE = 'REVIEW_ROLE' AND bnh.RUN_FLAG = '1' AND EXISTS(SELECT ID FROM BPM_REVIEW_INFO WHERE NODE_HISTORY_ID=bnh.ID AND OPT_TIME IS NULL AND OPT_PERSON_ID=");
        strcat(x,y);
        strcat(x,") ) qnitemp ON bpi.ID = qnitemp.piid;");

       
        sprintf(chQuery,"%s",x);

        lr_output_message ("%s",chQuery);
    lr_mysql_query(Mconn,chQuery);
……
}

我查了很多资料都没有解决,希望各位大师能帮帮忙

jenery 发表于 2013-8-6 10:15:05

http://bbs.51testing.com/thread-138819-1-1.html这个和你的问题差不多的,
看他是吧Mconn这个改为数组类型的了

langu0823 发表于 2013-8-9 13:47:13

本帖最后由 langu0823 于 2013-8-12 15:12 编辑

恩 我修改了sql,不用strcpy 和strcat函数了。还是有这个问题。郁闷
页: [1]
查看完整版本: loadrunner链接mysql数据库后,controller中脚本运行4小时后报错,虚拟用户停止运行