You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue occurs specifically when calling a synchronous function (GetTestVariants) that processes these header values. Below is a simplified version of the code:
The []byte slices returned by ctx.Request.Header.Peek are converted to strings immediately, and the strings are passed to GetTestVariants.
The GetTestVariants function is synchronous and completes before the handler returns.
The lifecycle of the []byte slices should be valid for the entire duration of the handler function, as the handler does not return until GetTestVariants completes.
Problem:
Despite the above, I am encountering a segmentation fault when GetTestVariants is called. The fault does not appear to be caused by the lifecycle of the []byte slices, as they are converted to strings immediately and used synchronously. Or maybe I'm wrong and converting []byte to string does not necessary involve allocation, and underlying []byte reuse may occur.
Questions:
Is there any known issue with ctx.Request.Header.Peek or its interaction with synchronous functions?
Are there any additional considerations or edge cases I should be aware of when using ctx.Request.Header.Peek in this way?
The text was updated successfully, but these errors were encountered:
I am encountering the following segfault panic in my fasthttp handler function when using ctx.Request.Header.Peek to retrieve header values:
The issue occurs specifically when calling a synchronous function (GetTestVariants) that processes these header values. Below is a simplified version of the code:
The GetTestVariants function is synchronous and completes before the handler returns. Here is its implementation:
Observations:
The []byte slices returned by ctx.Request.Header.Peek are converted to strings immediately, and the strings are passed to GetTestVariants.
The GetTestVariants function is synchronous and completes before the handler returns.
The lifecycle of the []byte slices should be valid for the entire duration of the handler function, as the handler does not return until GetTestVariants completes.
Problem:
Despite the above, I am encountering a segmentation fault when GetTestVariants is called. The fault does not appear to be caused by the lifecycle of the []byte slices, as they are converted to strings immediately and used synchronously. Or maybe I'm wrong and converting []byte to string does not necessary involve allocation, and underlying []byte reuse may occur.
Questions:
Is there any known issue with ctx.Request.Header.Peek or its interaction with synchronous functions?
Are there any additional considerations or edge cases I should be aware of when using ctx.Request.Header.Peek in this way?
The text was updated successfully, but these errors were encountered: