[GH-ISSUE #1329] Freeze of application when trying to enter query arguments in WebSocket URL #434

Closed
opened 2026-03-16 15:18:13 +03:00 by kerem · 9 comments
Owner

Originally created by @levrik on GitHub (Nov 15, 2020).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1329

Describe the bug

Typing ? or = in WebSocket URLs cause freezes or let the whole application hang.

To Reproduce

Type a long URL as WebSocket URL. For example ws://localhost:8000/ws/2f2dffb6-55e0-49b4-a879-8d2470dbed12.
Now add a ? to the end, you'll experience a freeze. Type a query argument name and try to enter =.
You'll experience a freeze again. I didn't wait this time since it didn't resolve after over a minute.

Expected behavior

To don't freeze.

GIFs

2020-11-15_14-37-09

On the last freeze at the end of the GIF I was trying to insert =.

Desktop (please complete the following information):

  • OS: Windows 10 Version 20H2
  • Browser: Chrome
  • Version: 86

Additional context

This doesn't happen on shorter URLs. For example no way to reproduce with the example URL wss://echo.websocket.org by just trying to add a query parameter here.
But can also be reproduced by just adding some more characters as path. The longer the whole URL gets, the worse the freeze on entering ? or =.
Also happens in Socket.IO tab, doesn't happen for SSE and MQTT.
Also not for other top-level tabs outside of Realtime.

Originally created by @levrik on GitHub (Nov 15, 2020). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1329 **Describe the bug** Typing `?` or `=` in WebSocket URLs cause freezes or let the whole application hang. **To Reproduce** Type a long URL as WebSocket URL. For example `ws://localhost:8000/ws/2f2dffb6-55e0-49b4-a879-8d2470dbed12`. Now add a `?` to the end, you'll experience a freeze. Type a query argument name and try to enter `=`. You'll experience a freeze again. I didn't wait this time since it didn't resolve after over a minute. **Expected behavior** To don't freeze. **GIFs** ![2020-11-15_14-37-09](https://user-images.githubusercontent.com/9491603/99186385-3c737a80-2750-11eb-9134-3a26e8673145.gif) On the last freeze at the end of the GIF I was trying to insert `=`. **Desktop (please complete the following information):** - OS: Windows 10 Version 20H2 - Browser: Chrome - Version: 86 **Additional context** This doesn't happen on shorter URLs. For example no way to reproduce with the example URL `wss://echo.websocket.org` by just trying to add a query parameter here. But can also be reproduced by just adding some more characters as path. The longer the whole URL gets, the worse the freeze on entering `?` or `=`. Also happens in `Socket.IO` tab, doesn't happen for SSE and MQTT. Also not for other top-level tabs outside of `Realtime`.
kerem 2026-03-16 15:18:13 +03:00
Author
Owner

@levrik commented on GitHub (Nov 18, 2020):

@liyasthomas Wondering why this is considered minor since I always have to pre-type the URL somewhere else and copy it to Hoppscotch now. And if you forget about this, completely freezing, going to Task Manager and killing the process, restarting, putting URL in again. This costs a lot of time.

<!-- gh-comment-id:729483225 --> @levrik commented on GitHub (Nov 18, 2020): @liyasthomas Wondering why this is considered minor since I always have to pre-type the URL somewhere else and copy it to Hoppscotch now. And if you forget about this, completely freezing, going to Task Manager and killing the process, restarting, putting URL in again. This costs a lot of time.
Author
Owner

@hariaakash commented on GitHub (Nov 26, 2020):

This is an issue with the Regex test-taking more time to complete especially with special characters and hanging the tab. There are two ways to solve this IMO. Probably debounce can help the user enter the URL completely. Or when the user clicks on submit then test and throw error.

<!-- gh-comment-id:734432457 --> @hariaakash commented on GitHub (Nov 26, 2020): This is an issue with the Regex test-taking more time to complete especially with special characters and hanging the tab. There are two ways to solve this IMO. Probably debounce can help the user enter the URL completely. Or when the user clicks on submit then test and throw error.
Author
Owner

@connorwang commented on GitHub (Nov 30, 2020):

We're having same issue.

<!-- gh-comment-id:735579737 --> @connorwang commented on GitHub (Nov 30, 2020): We're having same issue.
Author
Owner

@AndrewBastin commented on GitHub (Nov 30, 2020):

Yeah. As @hariaakash pointed out, a good solution for this would be to debounce the check. But it may still freeze out. So I was thinking of a way to run tests asynchronously or atleast in a non-blocking way so the UI doesn't freeze up during the test (web worker ? custom logic which splits test work to smaller tasks ran during free time ? etc.)

But I think debouncing would be a good start. If anyone wants to pick it up, please feel free. Else I will get it done in the coming days.

<!-- gh-comment-id:735814720 --> @AndrewBastin commented on GitHub (Nov 30, 2020): Yeah. As @hariaakash pointed out, a good solution for this would be to debounce the check. But it may still freeze out. So I was thinking of a way to run tests asynchronously or atleast in a non-blocking way so the UI doesn't freeze up during the test (web worker ? custom logic which splits test work to smaller tasks ran during free time ? etc.) But I think debouncing would be a good start. If anyone wants to pick it up, please feel free. Else I will get it done in the coming days.
Author
Owner

@hariaakash commented on GitHub (Nov 30, 2020):

I have fixed this, will make a PR @AndrewBastin

<!-- gh-comment-id:735819269 --> @hariaakash commented on GitHub (Nov 30, 2020): I have fixed this, will make a PR @AndrewBastin
Author
Owner

@levrik commented on GitHub (Nov 30, 2020):

@AndrewBastin I'm a bit confused why the regex is required at all in this tab. Other tabs don't hang on the same URL so it seems that they don't run this regex. What's the difference between the tabs?

<!-- gh-comment-id:735904326 --> @levrik commented on GitHub (Nov 30, 2020): @AndrewBastin I'm a bit confused why the regex is required at all in this tab. Other tabs don't hang on the same URL so it seems that they don't run this regex. What's the difference between the tabs?
Author
Owner

@liyasthomas commented on GitHub (Nov 30, 2020):

Regex is basically used in all tabs/pages to validate the input URL. In the case of WebSocket, it validates URL for ws/wss protocols.

<!-- gh-comment-id:735960173 --> @liyasthomas commented on GitHub (Nov 30, 2020): Regex is basically used in all tabs/pages to validate the input URL. In the case of WebSocket, it validates URL for ws/wss protocols.
Author
Owner

@levrik commented on GitHub (Nov 30, 2020):

@liyasthomas I see but I don't really get why it is slowing down so much. Shouldn't checking for ws:// or wss:// at the beginning of the string be enough in this case?
I'm guessing that it shouldn't be too bad to test for a valid URL in general as well on top of this, so regex doesn't seem wrong as well but for other parts of the app, this freeze doesn't happen so I'm wondering what the difference here is between the regex patterns.
I didn't look at the code here so I'm just randomly guessing.

<!-- gh-comment-id:735963975 --> @levrik commented on GitHub (Nov 30, 2020): @liyasthomas I see but I don't really get why it is slowing down so much. Shouldn't checking for `ws://` or `wss://` at the beginning of the string be enough in this case? I'm guessing that it shouldn't be too bad to test for a valid URL in general as well on top of this, so regex doesn't seem wrong as well but for other parts of the app, this freeze doesn't happen so I'm wondering what the difference here is between the regex patterns. I didn't look at the code here so I'm just randomly guessing.
Author
Owner

@liyasthomas commented on GitHub (Dec 1, 2020):

@levrik can you confirm this deploy preview solves this issue.

Deploy preview: https://deploy-preview-1354--hoppscotch.netlify.app/realtime

cc: @connorwang

<!-- gh-comment-id:736515068 --> @liyasthomas commented on GitHub (Dec 1, 2020): @levrik can you confirm this deploy preview solves this issue. Deploy preview: https://deploy-preview-1354--hoppscotch.netlify.app/realtime cc: @connorwang
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#434
No description provided.