Frame must be terminated with a null octet error in Jmeter - spring-boot

I have to load test a WebSocket on Jmeter. WebSocket has been implemented using Springboot.
I am facing an issue while sending Stomp data on Jmeter while testing. I am framing text appropriately according to stomp frame. This is the CONNECT frame:
log.info("Connect PreProcessor");
String con = "CONNECT\n" +
"login:${wsToken}\n" +
"passcode:admin\n" +
"accept-version:1.1,1.0\n" +
"heart-beat:0,0\n" +
"\n"+'\0' ;
vars.put("wsStompCon", con);
I am making a send request and when I am subscribing to the connection, AMQ establishes a connection, and I get the CONNECTED response. So no issue in connection.
The issue happens when I am sending data as:
String User = "SEND\n" +
"content-length:39\n" +
"destination:/app/chat.newUser\n\n" +
"{\"sender\": \"Usr111222\",\"type\":\"JOIN\"}" +
'\0' ;
vars.put("wsAddUser", User);
I put the var 'wsAddUser' in the send sampler and am sending the data.
I get this error in response sampler:
ERROR
message:
Frame must be terminated with a null octet
content-length:0
I am using websocket plugin by Peter Doornbosch mentioned:
https://bitbucket.org/pjtr/jmeter-websocket-samplers/src/master/
I have changed the encoding to UTF-8 in Jmeter.Properties file as well. I think the issue is due to encoding but I'm not sure. What changes should I do for this issue?

It looks like your calculation of the content-length header is not very correct as {"sender": "Usr111222","type":"JOIN"} is 37 octets and \0 is another octet so it should be 38.
It is not recommended to inline JMeter Functions or Variables into Groovy scripts so you need to replace this line:
"login:${wsToken}\n" +
with this one:
"login:" + vars.get("wsToken") + "\n" +
(as long as it's not a GStringTemplate)
where vars stands for JMeterVariables class instance, see the JavaDoc for more information and Top 8 JMeter Java Classes You Should Be Using with Groovy for description of other JMeter API shortcuts available for the JSR223 Test Elements

Related

ISO 8583 Message Giving Timeout Error in JMeter

I'm scripting for ISO Messages using JMeter to do Load Testing. I have used the ISO 8583 Sampler and connection configuration. All the data field by field is mapped correctly including the MTI (Field 0). But the issue is that the request is not being sent to the server from the JMeter. It just keep on giving the timeout issue and I'm getting no response against it. I've seen the request and validated it format from the implementer himself and he says that the format is correct. Can anyone help to trouble shoot this issue?
Check out Why am I getting timeouts? documentation section,
Why am I getting timeouts?
The three common reasons for response timeouts are:
The sampler does not receive any response.
The sampler does receive a response but fails to unpack it.
The sampler does receive a response and unpacks it but no request can be matched.
The debug log should contain Channel output similar to the following:
2022-02-22 12:34:56,789 DEBUG n.c.b.j.i.Q2: (channel/HOSTNAME:POST) [send] Out: 0800 000001
2022-02-22 12:34:56,987 DEBUG n.c.b.j.i.Q2: (channel/HOSTNAME:POST) [receive] In: 0810 000001
If only the first log line is present, no response was received (case 1 above). It is likely that the request is incorrectly formed and the remote system discarded it, so checking its logs/traces may be helpful. Double-check the Packager Configuration file! This defines how a request is packed (or response is unpacked) before (after) it goes over the wire.
If both lines are present, a response was in fact received (cases 2 and 3 above).
If the second log line instead contains an error like the following, then the response failed to unpack (case 2 above). Double-check the Packager Configuration file!
2022-02-22 12:34:56,987 ERROR n.c.b.j.i.Q2: (channel/HOSTNAME:POST) [receive] org.jpos.iso.SOMECLASSNAMEHERE: Problem unpacking field ...
If the second log line contains no error then it is likely that the plugin did not find a matching request (case 3 above). Double-check the Mux Settings! These define MTI values and message fields that are used for matching, and the default settings may not work.
In order to increase JMeter's logging verbosity for the ISO 8583 sampler add the next line to log4j2.xml file:
<Logger name="nz.co.breakpoint.jmeter.iso8583" level="debug" />
JMeter restart will be required to pick up the change.
Also make sure that you can reach the target server host/port from the machine where JMeter is running using a telnet client or equivalent.

Response time for websockets using Jmeter

I am using Jmeter for performance testing of my application. I am testing the websocket component and for that I am using plugins (Peter Doornbosch and Maceij Zaleski)
I am getting proper response back from websocket but I am stuck in finding out the response time of websocket component. I am using the listener 'View result tree' and it gives me back 'Load Time' but the value of this field varies with response timeout.
For ex : If I give response timeout as 1000 ms , the result comes like (1000 + few ms )
If I give response timeout as 500 ms , the result comes like (500 + few ms)
Please let me know if there is any way to find out the accurate response time.
enter image description here
enter image description here
enter image description here
From what I see from the screenshots:
You're using the plugin from Maceij Zaleski
It reads from the stream for the specified amount of time
If you're interested in getting the timings for reading a single message - I would suggest switching to WebSocket Single Read Sampler from Peter Doornbosch
More information:
Single read sample.jmx example test plan
JMeter WebSocket Samplers - A Practical Guide

Mqtt connection & data publisher misinterpreted in JMeter

I have jmeter , where a single thread contains two mqtt gateway connection sampler & each sampler have three publishers connected to iothub.
Jmeter reference:
When I run the thread in loop 6frames / second for 10 seconds, I could see all 60 frames published successful in JMeter.
But when I check data count at iothub, first gate way point have received only 6 frames ( some data get missed it seems, problem with jmeter I assume ) & second gateway have received 42 frames. Second part led to major confusion, when it have to receive maximum of 30 frames, but received 42.
Diagram reference:
Each gateway (A &B) include the Connection panel with :
Iothub URL
Mqtt v 3.1.1
Username: iothuburl/device ID
Pwd: SAS token ( generated SAS from connection string available at iothubowner page from azure portal).
Each Gateway (A&B) include
three publishers & Each includes 200 JSON objects and size doesn't exceed 55kb.
Publisher QoS: 0
Operation:
For every one second, each gateway publish 3 frames ( total 600 JSON objects).
As I have mentioned 2 gateway, so total 6 frames with 1200 JSON object get published successful in JMeter.
But the data is missing at iothub.
note: while running two gateway in single thread, i could both gateway connection sharing the common connection string ID.
Any clue, where did I miss the major configuration, any help would be greatly appreciated. Thanks.
Change the QoS=1 in publisher panel. Though we have few latency time to wait for acknowledgement, but the simulation works fine without any loss of connection/data.

jmeter showing error when HTTP request is made

I am totally new to JMeter, when I tried to test a website.
The test result was like this
Thread Name: Thread Group 1-1
Sample Start: 2018-06-19 10:18:49 IST
Load time: 0
Connect Time: 0
Latency: 0
Size in bytes: 1176
Sent bytes:0
Headers size in bytes: 0
Body size in bytes: 1176
Sample Count: 1
Error Count: 1
Data type ("text"|"bin"|""): text
Response code: Non HTTP response code: java.net.URISyntaxException
Response message: Non HTTP response message: Expected closing bracket for IPv6
What might be the issue?
Looks like improper HTTP Request sampler configuration, for instance you put some not supported character into "Server Name or IP" field. Well-behaved request should look like:
Another option is placing the full URL into "Path" field like
However the best option will be just recording your test scenario using JMeter's HTTP(S) Test Script Recorder, this way JMeter will generate appropriate HTTP Request samplers which you will be able to replay with increased number of threads. See Apache JMeter proxy Step-by-step guide for comprehensive instructions.
Alternatively you can use JMeter Chrome Extension - in this case you will not have to set up proxies and worry about SSL certificates.

jmeter response code 204 and can't get content

I am doing a websocket stress test through jmeter2.9.
When I send a request and response with a "light" json. the result is ok.
But when the response json contains a base64 png(about 360kb) . jmeter return code 204 No content (probably timeout).
Is my jmeter need some config here, or something else wrong.
If someone know something about this please teach me.
complete info:
Thread Name: threadgroup 1-1
Sample Start: 2013-07-17 15:36:06 CST
Load time: 20000
Latency: 0
Size in bytes: 0
Headers size in bytes: 0
Body size in bytes: 0
Sample Count: 1
Error Count: 1
Response code: 204
Response message: No content (probably timeout).
Response headers:
SampleResult fields:
ContentType:
DataEncoding:
Check if you are using Cache manager, there seems to be a (bug) in Jmeter that sets the response code to HTTP Code '204' ("No Response") while, there is no outgoing request, the information is retrieved from the Cache, try disabling cache manager and lets see if you can reproduce it then.
This could be because of the unhandled exception, response being larger than the maximum message size specified in the plugin code, etc. The exception which you see will be thrown if no response has been received from the server after predefined timeout.
Here is another WebSocket plugin for JMeter which might work for you
Link: https://github.com/maciejzaleski/JMeter
Features:
Supports HTTS/HTTPS (ws/wss) version of the WebSocket protocol
Option to ignore SSL certificate errors
Streaming allows for a single connection to remain open for the duration of the test
Response has to match predefined regular expression
Response timeout
Response message back log (build the Sampler response from multiple server messages)
Connection could be closed if server sends a mesage matching predefined regular expression

Resources