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
As per title, the Handler has a data race in assigning Prefix due to the sync.Once being function scoped and Prefix existing in the swaggo/files package.
This means that any reads to files.Handler.Prefix are globally unsafe across all swaggo packages.
The race can be avoided by only ever invoking one handler. This is not very likely to happen in practice, but problematic in tests. The way it's written also unfortunately means it's impossible to serve on two different endpoints (just an observed behavior, not a requirement).
The text was updated successfully, but these errors were encountered:
This happens in practice as well. I have 2 routes defined for 2 different swaggers files. /swagger/*any and /swagger-swe/*any and I pass different handlers for them httpSwagger.Handler() and httpSwagger.Handler(httpSwagger.InstanceName("swe")). However only one of them works.
As per title, the
Handler
has a data race in assigningPrefix
due to thesync.Once
being function scoped andPrefix
existing in theswaggo/files
package.The problematic code:
http-swagger/swagger.go
Lines 157 to 159 in c8d62bf
This means that any reads to
files.Handler.Prefix
are globally unsafe across all swaggo packages.The race can be avoided by only ever invoking one handler. This is not very likely to happen in practice, but problematic in tests. The way it's written also unfortunately means it's impossible to serve on two different endpoints (just an observed behavior, not a requirement).
The text was updated successfully, but these errors were encountered: