Highlighted
Contributor.
Contributor.
761 views

Winsock lrs_get_static_buffer: error - memory violation

Good day!

 

I'm experiencing problems running my Vugen Winsock script on remote Load Generator (Performance Center Host).

Script is working fine while its started with VuGen on local machine.

Script is working fine on remote Load Generator while script is sending unmodified data from recording with all replace_data() calls commented.

On Load Generator it fails with run time error on first lrs_get_static_buffer() call.

Static buffer "buf0" which i'm trying to get is holding only 61 bytes.

send buf0 61

"\n"

"\x00"

...

"R\b"


recv buf1 32
...

 

"data.ws" file content is intact from recording phase.

 

Please help me with this.

 

Error from VUser log:

Action.c(138):  lrs_get_static_buffer(socket0, buf0, 0, -1, null)

Action.c(138): Error: Сinterpreter run time error: Action.c (138): Error -- memory violation : Exception ACCESS_VIOLATION recieved.

Code:

char * buffer;


...


int replace_data (char * buffer_desc)

{

long size;

...

buffer = lrs_get_static_buffer("socket0", buffer_desc, 0, -1, NULL);

size = lrs_get_user_buffer_size("socket0");

...

// replacing some bytes

...

lrs_set_send_buffer("socket0", buffer, size);

}


Action()

{

int rc;
buffer = (char *) malloc (4096 * sizeof(char)); ... rc = lrs_create_socket("socket0", "TCP", "RemoteHost={hostname}:{port}", LrsLastArg); ... replace_data("buf0"); rc = lrs_length_send("socket0", "buf0", 0, LrsLastArg); ... rc = lrs_close_socket("socket0"); }

 

0 Likes
4 Replies
Highlighted
Contributor.
Contributor.

Re: Winsock lrs_get_static_buffer: error - memory violation

Any suggestions?

0 Likes
Highlighted
Honored Contributor.
Honored Contributor.

Re: Winsock lrs_get_static_buffer: error - memory violation

Hi,

I wonder why you are performing memory allocation in the buffer as the function returns a pointer to the data. By allocating memory and not releasing it, you are creating memory leak.

In the function reference you can see that the example doesn't allocate memory to get the static buffer.

To change the buffer you wish to send you don't need to get the static buffer. Just verify that in this case the memory is allocated.

The lrs_set_send_buffer function specifies the buffer to send in the next call to lrs_send. The buffer specified in lrs_set_send_buffer is sent, and not the buffer designated in the lrs_send function.

0 Likes
Highlighted
Contributor.
Contributor.

Re: Winsock lrs_get_static_buffer: error - memory violation

1) I wonder why you are performing memory allocation in the buffer as the function returns a pointer to the data.

2) To change the buffer you wish to send you don't need to get the static buffer. Just verify that in this case the memory is allocated.

3) The lrs_set_send_buffer function specifies the buffer to send in the next call to lrs_send. The buffer specified in lrs_set_send_buffer is sent, and not the buffer designated in the lrs_send function.

Pretty much know that. But, from my point of view, this is not a cause of problem in lrs_get_static_buffer call. Something about load generator internal work that i dont have a clue.

 

0 Likes
Highlighted
Contributor.
Contributor.

Re: Winsock lrs_get_static_buffer: error - memory violation

Still need help with this.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.