-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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]: Immutable configuration in Fiber not working as expected #3236
Comments
This is probably happening in v3 too. |
@gaby there’s also a data race occurring when storing a reference to Is there a way to determine if the request has been closed and the fiber.Ctx is no longer valid? |
@rebaz94 We probably missing it somewhere else. |
@rebaz94 Can you share the logs of the data race? |
Apologies for the delayed response. Here's a video demonstrating how you can reproduce the issue: Screen.Recording.2024-12-22.at.2.04.59.AM.mp4Here the logs
|
@rebaz94 Found the issue, it's related to |
Bug Description
The
Immutable
configuration option in Fiber, when set to true, is intended to ensure that certain request values (e.g., request bodies) are immutable and accessible beyond the handler's lifecycle. However, enabling this option does not work as expected, resulting in data race errors when the request body is processed within a differernt goroutine.Documentation Says:
Am I missing something here, or is this the expected behavior, and I need to manually copy the body to ensure immutability in my code?
How to Reproduce
Expected Behavior
The request body
c.Body()
should remain immutable and safe to access across goroutines without causing data races but actually get a data racesFiber Version
v2.52.5
Checklist:
The text was updated successfully, but these errors were encountered: