Fix race condition in named pipe server causing missed link clicks#217
Open
AaronFeledy wants to merge 1 commit intoU-C-S:mainfrom
Open
Fix race condition in named pipe server causing missed link clicks#217AaronFeledy wants to merge 1 commit intoU-C-S:mainfrom
AaronFeledy wants to merge 1 commit intoU-C-S:mainfrom
Conversation
a4cc7ad to
4e606cb
Compare
Owner
|
Thanks for the PR. Will have a look later this week |
When Hurl runs minimized to tray, the first link click is sometimes ignored while subsequent clicks work. This is caused by a race condition in the named pipe server: after handling a connection, the pipe is disposed before a new one is created, leaving a brief window where no pipe exists. If the Launcher connects during this window, the URL is lost. Fix by implementing overlapping pipe server instances that ensure at least one listener is always ready. When a connection is received, a replacement listener spawns immediately before processing begins. Changes: - Add NamedPipeUrlReceiver service with overlapping listener pattern - Use proper async/await instead of .Wait() anti-pattern - Remove EventWaitHandle (no longer needed with robust pipe server) - Add 5-second read timeout to prevent hung connections
4e606cb to
24b2aee
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When Hurl runs minimized to the system tray, clicking a link sometimes does nothing on the first click, but works on the second click. The tray service hasn't crashed—it just doesn't respond to the first invocation.
Root Cause
A race condition exists in the named pipe server communication between the Launcher and BrowserSelector:
Hurl.exeSolution
Implement overlapping named pipe server instances that ensure at least one listener is always ready:
async/awaitinstead of.Wait()anti-patternChanges
Source/Hurl.BrowserSelector/Services/NamedPipeUrlReceiver.cs- Encapsulated pipe server with overlapping listener patternSource/Hurl.BrowserSelector/App.xaml.cs- Use new service, remove old pipe server and EventWaitHandle codeFixes #202