Update request and response sampler to ignore server side push messages.

Issue #26 closed
Former user created an issue

First of all, Thanks you Peter for this great plugin.

Background- I'm trying to do performance testing of meteor app using JMeter, Meteor app uses DDP protocol based on websocket. Due to reactive nature of app, it is not only responds to requests [RPC to be precise] but also pushes data to client irrespective of calls to server. Also once connection if formed, it will keep ping -pong ongoing to keep connection active.

Due to this nature, I cannot use actively request-response sampler. For One request there can be number of responses and also some data pushed by the server.

By any chance would it be possible to ignore the rest of the response and keep waiting for particular response till response timeout

Comments (39)

  1. Peter Doornbosch repo owner

    Hi,

    Thanks for your feedback. Yes, that is possible. Please checkout the 'filter' branch. It's not completely finished yet, but functional and I think it could suit your needs. Would like to hear if that is the case...

    Regards, Peter

  2. Amol Chavan

    Hello Peter,

    Thanks for taking time to reply. I checkout 'filter' branch and build the plugin , But assertion in Request-Response sampler still fails as it is getting different response. could it be possible to make provision to have accepted response as parameter in the sampler?

    Thanks- Amol

  3. Amol Chavan

    Hello Peter,

    Earlier I tried with the request-response sampler and never used config element => WebSocket Text Frame Filter [which I supposed to use, I assumed that you made changes in the sampler itself.]. Now I'm using this config element and I can partially achieve what I want but It seems that When I use 'BeanShell PreProcessor' & 'WebSocket Text Frame Filter.' together, Bean Shell processor seems not not be working for me.

    Thanks for the branch details and awesome work- Amol

  4. Peter Doornbosch repo owner

    Nice. If you have any feedback on the filter stuff, please let me know. Also, if you have a reproducable case of Filter and BeanShell not working together, i'll be happy to investigate.

  5. Amol Chavan

    Hello Peter,

    I was facing issue with the sampler, I'm getting -

    Sampler error: unexpected frame type./Received: Close frame with status code 1000 and close reason 'Normal closure'
    

    I checkout the latest code for filter branch to debug the issue and found that

    UnexpectedFrameException
    

    Class file is missing from the source, what am I missing here?

  6. Amol Chavan

    Thanks Peter for quick response.

    Sampler error: unexpected frame type./Received: Close frame with status code 1000 and close reason 'Normal closure'
    

    I am facing this issue when I execute script in distributed, non GUI mode in Google cloud. its working fine on Local machine with and without GUI mode. What could be the possible cause? I already checked code, couldn't find anything helpful with my limited knowledge. Can you please point me the right direction? What shall I check to get to the root of this issue?

  7. Peter Doornbosch repo owner

    Your server is sending a close, while you (your JMeter test client) is still expecting a data frame. It's probably a timing issue. For example, if your server decides to close after 60 seconds of inactivity, and your client sends a frame after 59.9 seconds and expects a response, it depends on network latency which answer will be first. Another factor that might influence server behaviour is server load; it could be the under high load the server cannot respond fast enough to your data request and for some reason (maybe because the load is too high ;-)) closes the connection.

  8. Amol Chavan

    I would have happily to agree with you :-) but evidences are against it. Same server working absolutely fine for 300 users when script executed from local machine and script is failing with above error when executed in cloud even for 30 users. Do you think, by any chance, that cloud instance would be the reason for the error. Or any client configuration on the machine causing this?

  9. Peter Doornbosch repo owner

    Hi Amol,

    I cannot image how the cloud instance would be causing the error. And the same holds for client configuration.

    Furthermore, i think it's very unlikely that there is an issue in the plugin that causes this issue. The plugin is (by design) single-threaded, i.e. it runs solely on the JMeter thread-group thread. This guarantees that all messages are received in order, i.e. in the same order they are sent over the network. This is why i think the reason for this behaviour is somewhere in the server: the server is sending a close message at a moment when you do not expect it. I guess the crux is finding out why the server behaves like this (or just accepted it and modify the test plan to expect it ;-)).

    I wonder why you are so sure that it is not a timing issue; i guess the network paths from local machine to server versus cloud instance to server are rather different, and thus, timing of messages can be different, don't you think?

  10. Amol Chavan

    HI Peter,

    Thanks for response. As per your comment, I am following with our development team on the issue mentioned and soon we will have something to monitor web-socket connections on server. :-)

    Meanwhile I'm facing another issue with Response assertion when used with the

    WebSocket Text Frame Filter
    

    ResponseAssertion.png

    ResponseData.png

    ResponseAssertionResult.png

  11. Peter Doornbosch repo owner

    Hi,

    I tried to reproduce this problem, but my test plan (see attachment), works fine. Can you spot the differences between my plan and yours?

  12. Amol Chavan

    Hi Peter,

    Apologies for the delayed response.

    I am not able to reproduce the issue mentioned now, I also tried with your jmx and it seems to be working fine for me now.

    Thanks- Amol

  13. Amol Chavan

    Hi Peter,

    Just curios to know which version of JMeter you are using. Currently I am using JMeter 3.2, and I started to see many issues with the plugin.Could that be possible reason for the issues?

  14. Peter Doornbosch repo owner

    Hi,

    Mostly i'm using JMeter 3.1, but occasionally i'm using 3.2.

    What kind of issues are you having?

  15. Amol Chavan

    Hi,

    I will attach jmx script created using JMeter 3.2 here for your referance. I need to make changes in them so that you can use/test it right away. Will keep you posted...

  16. Amol Chavan

    Hi Peter,

    Please find attached jmx file, I can reproduce the issue Beanshell PreProcessor is not working when used with WebSocket Text Frame Filter.

    Also it would be great help if you can display whatever WebSocket request we have made using WebScoket Request-Response sampler in View Results Tree. It only gets displayed if response is as expected now and not displayed for failed requests.

    Thanks-

    Amol.

    I was unable to attach file, so pasting code as xml from jmx file. -please find file here --


  17. Peter Doornbosch repo owner

    Pushed the changes. Btw., i noticed that you escaped the { in the filter with a . This is not necessary for a plain text filter and will probably lead to other behaviour than you intended....

  18. Amol Chavan

    Thanks a lot Peter.

    Regarding escaping curly braces, I didn't understand how it can lead to unintended behavior. Basically, my objective is to assert few values from the JSON. And as I communicated earlier server pushes some additional data and ping/pongs which I'm not interested in so I have to use WebSocket Text Frame Filter to wait for correct JSON.

    Let me know if there is a better way to do that. Regards, Amol.

  19. Peter Doornbosch repo owner

    Hi,

    Sorry for the confusion. What i meant was that the filter is filtering (discarding) messages that do not contain {"msg": etc (and the \ is taken literally!), but in the request data i see that you're sending a message that starts with {"msg": etc, so without the "\". So i assume that what you really want to do is filter messages that do not contain {"msg" :etc and in order to do so, you should drop the "\" from the filter match value... Does that help?

  20. Amol Chavan

    Hello Peter,

    Thanks for your concern. Actually, I'm using regular expression in WebSocket Test Frame Filter. So to ignore the special characters like curly braces I have to use back slash.

    Thanks- Amol.

  21. Peter Doornbosch repo owner

    Ok, fine. It's just that in the version i downloaded, the filter was configured for plain text matching....

  22. Amol Chavan

    Hi Peter,

    If my request fails [due to server error or due to bad request], I cannot see Request I made to the server in the Request tab of 'View Tree Result' Listener. I need to go to server or use some different tool to check what was missing from the request. Is it possible to display every request we make in the request tab of 'View Tree Result' Listener ?

  23. Peter Doornbosch repo owner

    There you go.

    (I already fixed this on the main branch after your comment a few days ago; now also available on filter branch.)

  24. Peter Doornbosch repo owner

    As the filter functionality is released today, i'm going to close this issue. In case you might find other bugs, just file new issues.

  25. Shweta

    Hi @amolchavan Were you able to resolve this null response issue: Sampler error: unexpected frame type./Received: Close frame with status code 1000 and close reason 'Normal closure' If yes, appreciate your inputs. I am facing the same issue while executing a test in cloud. Thanks, Shweta

  26. Amol Chavan

    Hi @shwhooda, Peter has addressed my query in this comments thread itself. I also went through the ticket you have created and it seems to me that the server is not able to handle that much load.

    Thanks- Amol

  27. Shweta

    Hi @amolchavan Thanks for your response. I know you discussed a few issues in this thread. I was mainly concerned about the error message: Sampler error: unexpected frame type./Received: Close frame with status code 1000 and close reason 'Normal closure'

    How was it fixed? Was it is server issue in your case? Also, I am getting this issue in non-gui only.

  28. Log in to comment