[PR #18] [MERGED] Ignore client connection closing - simpler challenge response error handling #26

Closed
opened 2026-02-28 01:18:04 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/therealpaulgg/ssh-sync-server/pull/18
Author: @therealpaulgg
Created: 3/22/2024
Status: Merged
Merged: 3/22/2024
Merged by: @therealpaulgg

Base: mainHead: fixing-critical-bugs


📝 Commits (1)

📊 Changes

2 files changed (+23 additions, -47 deletions)

View changed files

📝 docker-compose.yaml (+5 -5)
📝 pkg/web/live/main.go (+18 -42)

📄 Description

There were significant oversights in the pull request #17.

While this code provided a great way of determining if the client indeed killed their session, there was a significant issue that arose, where this goroutine would read the first byte from the connection, causing any other readers which relied on this byte to effectively break themselves.

This code has been greatly simplified to, on the challenge responder side, simply check to see if we are receiving data from the channel (the channel closes, returning nil bytes). This was previously assuming any data obtained from the channel was in fact a byte array, which was false.

This code also resolves another bug, in which there was a goroutine reading from a channel from which the main thread was reading. While this code went unnoticed for a while, it was the cause of earlier panic issues (which were later obscured by concurrency bug fixes). The main channel always wins the race condition; but if it were to lose, this would result in a deadlock. The code has been simplified to have a channel created on the main thread, which the goroutine responds to either the timer expires or there is a message received from the Challenge Accepted channel (which other goroutines write to).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/therealpaulgg/ssh-sync-server/pull/18 **Author:** [@therealpaulgg](https://github.com/therealpaulgg) **Created:** 3/22/2024 **Status:** ✅ Merged **Merged:** 3/22/2024 **Merged by:** [@therealpaulgg](https://github.com/therealpaulgg) **Base:** `main` ← **Head:** `fixing-critical-bugs` --- ### 📝 Commits (1) - [`5b457ad`](https://github.com/therealpaulgg/ssh-sync-server/commit/5b457adb04e6b944b73d2cf15eb13847a880b5b2) i has issues ### 📊 Changes **2 files changed** (+23 additions, -47 deletions) <details> <summary>View changed files</summary> 📝 `docker-compose.yaml` (+5 -5) 📝 `pkg/web/live/main.go` (+18 -42) </details> ### 📄 Description There were significant oversights in the pull request #17. While this code provided a great way of determining if the client indeed killed their session, there was a significant issue that arose, where this goroutine would read the first byte from the connection, causing any other readers which relied on this byte to effectively break themselves. This code has been greatly simplified to, on the challenge responder side, simply check to see if we are receiving data from the channel (the channel closes, returning nil bytes). This was previously assuming any data obtained from the channel was in fact a byte array, which was false. This code also resolves another bug, in which there was a goroutine reading from a channel from which the main thread was reading. While this code went unnoticed for a while, it was the cause of earlier panic issues (which were later obscured by concurrency bug fixes). The main channel always wins the race condition; but if it were to lose, this would result in a deadlock. The code has been simplified to have a channel created on the main thread, which the goroutine responds to either the timer expires or there is a message received from the Challenge Accepted channel (which other goroutines write to). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 01:18:04 +03:00
Sign in to join this conversation.
No labels
pull-request
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/ssh-sync-server#26
No description provided.