在Virtual User Generator下,脚本运行一切正常。但是在Controller下,我把Run-Time Setting设置中的迭代次数Iteration Count从10~250这个值陆续放大的时候,会出现Socket数据包发送失败的情况,具体报错为“Action.c(102): Error: An error occurred while sending to the socket, Error Code: 9013”。当迭代次数设置为10的时候不会出现该错误,当迭代次数设置越来越大的时候,这种错误出现的概率也越来越高。
请教各位高人,帮我看一下这个是什么问题,有什么方法解决?
谢谢:)
[ 本帖最后由 豆奶板蓝根 于 2008-8-11 09:25 编辑 ]作者: sqlserveroracle 时间: 2008-8-11 10:58
could you please post your source code about script,
but first, you must understand the iteration operation. iteration means when you finish the running script,the script must run again until the times of running script reach the value you set in run-time setting. so the scripts don't be executed at the time.
according to the problem you report, I just conclude that your server maybe not reponse the client request immediately.作者: 豆奶板蓝根 时间: 2008-8-11 11:27
首先非常感谢二楼的。
在run-time setting中的Iteration间隔时间我使用的是“as soon as the previous iteration ends”,think time设置的是“Ignore think time”
return 0;
}作者: 豆奶板蓝根 时间: 2008-8-11 11:29
//Action
#include "lrs.h"
#include "template.h"
typedef long time_t;
struct tm {
int tm_sec; /* seconds after the minute - [0,59] */
int tm_min; /* minutes after the hour - [0,59] */
int tm_hour; /* hours since midnight - [0,23] */
int tm_mday; /* day of the month - [1,31] */
int tm_mon; /* months since January - [0,11] */
int tm_year; /* years since 1900 */
int tm_wday; /* days since Sunday - [0,6] */
int tm_yday; /* days since January 1 - [0,365] */
int tm_isdst; /* daylight savings time flag */
};
char oldField38[7];
char * psTsName = NULL;
Action()
{
int i;
char * templatebuf;
int flag = 0; //交易类型,0-独立交易,1-关联交易
lr_continue_on_error(1);
for (i=0; i<17; i++)
{
flag = msgtemplate.flag;
templatebuf = msgtemplate.msg;
psTsName = msgtemplate.casename;
lr_output_message("Case NO. = [%s], Case Name =[%s]\n",msgtemplate.caseno,msgtemplate.casename);
dotransaction(templatebuf,flag,psTsName);
}
lr_continue_on_error(0);
}
int dotransaction(char *templatebuf, int flag, char * psTsName)
{
int rc,sendlen;
char *inputbuf, buf8583[800], msghead[55], msglen[5], msgtype[5];
rc = lrs_send("socket5", "buf0", LrsLastArg);
if (0!=rc) {
lr_error_message("An error occurred while sending to the socket, Error Code: %d", rc);
lr_end_transaction(psTsName,LR_FAIL);
return -1;
}
lrs_free_buffer(inputbuf);
lr_end_transaction(psTsName,LR_AUTO);
return 0;
}
[ 本帖最后由 豆奶板蓝根 于 2008-8-11 11:32 编辑 ]作者: 豆奶板蓝根 时间: 2008-8-11 11:41 标题: 回复 2# 的帖子 according to the problem you report, I just conclude that your server maybe not reponse the client request immediately
-----------------------------------
关于这一条,我在Server端查看过日志,Client端发送失败的消息,确实没有在Server端有记录
另外说明,Server端用的是小型机,处理能力是非常强的,我用PC端发送的消息,小数据量还不能对Server端造成压力。作者: sqlserveroracle 时间: 2008-8-11 13:22
Thanks for your good source code for finding what cause the question.
according to Error Code: 9013, I look for its' meaning in some related document which say: Error in buffer translation. that means: maybe, the socket buffer have not been translated correctly.
now back to your souce code:
for (i=0; i<17; i++)
{
flag = msgtemplate.flag;
templatebuf = msgtemplate.msg;
psTsName = msgtemplate.casename;
lr_output_message("Case NO. = [%s], Case Name =[%s]\n",msgtemplate.caseno,msgtemplate.casename);
dotransaction(templatebuf,flag,psTsName);
}
// attention to following code
msgtemplate variable is in the circle for 17 times, I don't know where the msgtemplate derive from.
but I know, the msgtemplate is not initialized before you use.
for example:
when you first call dotransaction(....), it will modify templatebuf, then circle again
that's to say, at the second time,you then call dotransaction,it will modify templatebuf, that will happen
9013 error, just good luck, if any question, please contact me:qq:652466006,MSN:blzhang1@hotmail.com作者: 豆奶板蓝根 时间: 2008-8-11 14:21 标题: 回复 7# 的帖子 // attention to following code
msgtemplate variable is in the circle for 17 times, I don't know where the msgtemplate derive from.
but I know, the msgtemplate is not initialized before you use.
for example:
when you first call dotransaction(....), it will modify templatebuf, then circle again
------------------------------------------------------------------------------------------------------------------
应该不是脚本的逻辑处理问题,因为我在Virtual User Generator中,设置Iteration Count为250运行时,是不存在Socket发送失败的这个问题的,但到了Controller中,发送量一旦变得比较大的时候,就出现问题了。
有没有可能是我发送的数据包大小的原因。我发送的buffer长度大概在5、6百个字节。作者: sqlserveroracle 时间: 2008-8-11 15:18
I see, now I know maybe where the problem happened. according to what you said, the problem just happen when there are many virtual user ????not iteration(Is it all right)?? you can't explain very clearly, if this is multi-users' problem. I think it will happen in the dll library, you know, sometimes, dll library is very important for many things such as one copy in memory or providing many users to use it.
but for dll, you must consider synchronization and exclusion.
for your code:
unpack_master_8583(buf8583);
set_parm(msgtype,flag);
sendlen = pack_master_8583(buf8583);
sendlen += 50;
maybe, the function unpack_master_8583 or pack_master_8583 will operate the buffer. I don't know what purpose the function have, even the function is sourced from dll library. the exclusion is very important for you consideration. you can also post the source code .作者: 豆奶板蓝根 时间: 2008-8-11 15:46
在Controller中,我只用了一个虚拟用户在跑,所以应该不是你说的多用户调用dll产生的问题。
unpack_master_8583()函数的功能是ISO8583协议的解包程序,pack_master_8583()函数的功能是ISO8583的组包程序。