-
Notifications
You must be signed in to change notification settings - Fork 650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle bind failures when running NIO in a tight sandbox #2616
base: main
Are you sure you want to change the base?
Changes from 2 commits
d269c1c
cd40dee
3b33ceb
7f03ce8
e13a5b2
a4863a8
5f1d8c4
f18ea23
85bfd59
6d777bf
57266e9
ee340f1
1e9b010
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -266,14 +266,18 @@ final class ServerSocketChannel: BaseSocketChannel<ServerSocket> { | |
promise?.fail(error) | ||
} | ||
executeAndComplete(p) { | ||
switch target { | ||
case .socketAddress(let address): | ||
try socket.bind(to: address) | ||
case .vsockAddress(let address): | ||
try socket.bind(to: address) | ||
do { | ||
switch target { | ||
case .socketAddress(let address): | ||
try socket.bind(to: address) | ||
case .vsockAddress(let address): | ||
try socket.bind(to: address) | ||
} | ||
self.updateCachedAddressesFromSocket(updateRemote: false) | ||
try self.socket.listen(backlog: backlog) | ||
} catch { | ||
promise?.fail(ChannelError.bindFailed) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should definitely still fail the promise with the error produced by the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. after re thinking my approach the way I set up my sandbox to test this was not correct, thus nor is this solution. In the actual Now I am overriding the standard bind sys call thats called by NIO by creating a bind function that always returns
compile it down to a shared object and preload it and run the test. Going to use this approach to create a new solution here. In the actual |
||
} | ||
self.updateCachedAddressesFromSocket(updateRemote: false) | ||
try self.socket.listen(backlog: backlog) | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly this is a breaking change but I don't think we need this case at all.