-
Notifications
You must be signed in to change notification settings - Fork 626
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
Missing remoteAddress in ChatServer (Crash) #97
Comments
ezfe
changed the title
Missing remoteAddress in ChatServer
Missing remoteAddress in ChatServer (Crash)
Mar 4, 2018
Will have a look
… Am 04.03.2018 um 11:41 schrieb Ezekiel Elin ***@***.***>:
Expected behavior
When the ChatClient sends a message, other clients see
(##remoteAddress##) - ##message##
Actual behavior
The ChatServer force-unwraps the remoteAddress field, encountering nil, and crashes.
Steps to reproduce
Run ChatServer
Run ChatClient (once is all that's needed to demonstrate crash, twice for full set up)
Send message by typing in ChatClient and pressing enter
ChatServer unexpectedly encounters nil here: https://github.com/apple/swift-nio/blob/2c1d993978c97f286ae5e8f0fe4285bd47030a26/Sources/NIOChatServer/main.swift#L60
If possible, minimal yet complete reproducer code (or URL to code)
Provided ChatServer and ChatClient exhibit this behavior
SwiftNIO version/commit hash
2c1d993 (latest as this issue)
Swift & OS version (output of swift --version && uname -a)
Apple Swift version 4.0.3 (swiftlang-900.0.74.1 clang-900.0.39.2)
Target: x86_64-apple-macosx10.9
Darwin Ezekiels-MacBook-Pro-133.local 17.5.0 Darwin Kernel Version 17.5.0: Sun Feb 11 23:54:24 PST 2018; root:xnu-4570.50.279~25/RELEASE_X86_64 x86_64
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@ezfe hmm I can not reproduce it :( The remoteAddress should never be |
@ezfe ah never mind... I did execute the wrong example :( |
normanmaurer
added a commit
to normanmaurer/swift-nio
that referenced
this issue
Mar 4, 2018
Motivation: We missed to correctly update the cached remote and local addresses for accepted Channels. Because of this localAddress and remoteAddr always returned nil. Modifications: - Update cached addresses when constructing SocketChannel from existing Socket. - Add testcase Result: Fixes [apple#97].
@normanmaurer I've confirmed that this resolves the issue. You may close this issue when appropriate. |
Lukasa
pushed a commit
that referenced
this issue
Mar 5, 2018
Motivation: We missed to correctly update the cached remote and local addresses for accepted Channels. Because of this localAddress and remoteAddr always returned nil. Modifications: - Update cached addresses when constructing SocketChannel from existing Socket. - Add testcase Result: Fixes [#97].
Resolved by #98. |
weissi
pushed a commit
to weissi/swift-nio
that referenced
this issue
Jun 13, 2020
Motivation: When we're validating that settings are in their bounds, we should probably endeavour to express those bounds correctly. Modifications: - Fixed the bounds checks on SETTINGS_INITIAL_WINDOW_SIZE and SETTINGS_MAX_FRAME_SIZE. - Added regression tests. Result: Better correctness.
weissi
pushed a commit
to weissi/swift-nio
that referenced
this issue
Feb 3, 2024
* Wrap in parentheses * Revert previous changes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected behavior
When the ChatClient sends a message, other clients see
(##remoteAddress##) - ##message##
Actual behavior
The ChatServer force-unwraps the remoteAddress field, encountering nil, and crashes.
Steps to reproduce
swift-nio/Sources/NIOChatServer/main.swift
Line 60 in 2c1d993
Workaround
Modifying the above line referenced in part 4 to the following produces what appears to be expected behavior. However, I am unclear as to the difference between ctx.channel.remoteAddress and ctx.remoteAddress.
If possible, minimal yet complete reproducer code (or URL to code)
Provided ChatServer and ChatClient exhibit this behavior
SwiftNIO version/commit hash
2c1d993 (latest as this issue)
Swift & OS version (output of
swift --version && uname -a
)Apple Swift version 4.0.3 (swiftlang-900.0.74.1 clang-900.0.39.2)
Target: x86_64-apple-macosx10.9
Darwin Ezekiels-MacBook-Pro-133.local 17.5.0 Darwin Kernel Version 17.5.0: Sun Feb 11 23:54:24 PST 2018; root:xnu-4570.50.279~25/RELEASE_X86_64 x86_64
The text was updated successfully, but these errors were encountered: