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
🐛 [Bug]: setting a Logger that access TLSConnectionState() will break when app.Server().MaxConnsPerIP
is set to a value
#2990
Comments
Pls share the code for outputSerialFromContext And the error message |
func outputSerialFromContext(c *fiber.Ctx) string {
return c.Context().TLSConnectionState().PeerCertificates[0].SerialNumber.String()
}
… On Apr 27, 2024, at 6:44 PM, RW ***@***.***> wrote:
Pls share rhs code for outputSerialFromContext
—
Reply to this email directly, view it on GitHub <#2990 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABB2J6D6VVZA6KGFCOEG3UTY7QS3RAVCNFSM6AAAAABG4MVTPKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBRGIZDAOBXHA>.
You are receiving this because you authored the thread.
|
You need to make a copy https://docs.gofiber.io/#zero-allocation |
Nothing is persisting outside of the context call. The logger function prints the value from the tls connection state in the logger.Everything works as expected until you set the Server MaxConnsPerIP and then the TLSConnectionState returns nilOn Apr 28, 2024, at 2:13 AM, RW ***@***.***> wrote:
You need to make a copy https://docs.gofiber.io/#zero-allocation
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
I think the bug/issue is in the fasthttp package - The issue only occurs when the `MaxConnsPerIP` is greater than zero. Looking at the code in the package, they’re creating the connection differently in that case and perhaps that’s why the TLSConnectionState() is nil - but for it to be nil would mean that the connection isn’t a TLS connection - which isn’t the case for me…
… On Apr 28, 2024, at 2:13 AM, RW ***@***.***> wrote:
ch
You need to make a copy https://docs.gofiber.io/#zero-allocation
—
Reply to this email directly, view it on GitHub <#2990 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABB2J6FXL3TSQMX6X24G4WDY7SHQ3AVCNFSM6AAAAABG4MVTPKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBRGM2DSOJQGM>.
You are receiving this because you authored the thread.
|
here's a small example that demonstrates the bug:
if you set I think you can close this out and I should open it with their package... |
FYI - from valyala/fasthttp "I have pushed a fix. I'll tag a release next week probably." |
Bug Description
There is a condition where the
TLSConnectionState
fromContext( )
is nil - only whenapp.Server( ).MaxConnPerIP
is set to a value.How to Reproduce
app
app.Server( ).MaxConnPerIP = 1
Expected Behavior
no sigsegv
Fiber Version
v2@v2.52.4
Code Snippet (optional)
Checklist:
The text was updated successfully, but these errors were encountered: