mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-23 08:20:26 +00:00
1693863499
PROBLEM: - Pod crashes with "fatal error: concurrent map writes" during S3 publications - Root cause: pathCache map in PublishedStorage accessed without synchronization - Occurs during concurrent LinkFromPool operations in S3 publishing SOLUTION: - Add sync.RWMutex to PublishedStorage struct for thread-safe map access - Implement double-check locking pattern for cache initialization - Protect all map operations (read/write/delete) with appropriate locks CHANGES: - s3/public.go: Add pathCacheMutex field and protect all map operations * Cache initialization with double-check locking in LinkFromPool * Read operations protected with RLock/RUnlock * Write operations protected with Lock/Unlock * Delete operations in Remove() and RemoveDirs() protected IMPACT: - Eliminates concurrent map writes panic - Prevents pod crashes during S3 publications - Maintains performance with minimal synchronization overhead - Uses read-write locks allowing concurrent reads while serializing writes
22 lines
441 B
Go
22 lines
441 B
Go
package api
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// @Summary S3 buckets
|
|
// @Description **Get list of S3 buckets**
|
|
// @Description
|
|
// @Description List configured S3 buckets.
|
|
// @Tags Status
|
|
// @Produce json
|
|
// @Success 200 {array} string "List of S3 buckets"
|
|
// @Router /api/s3 [get]
|
|
func apiS3List(c *gin.Context) {
|
|
keys := []string{}
|
|
for k := range context.Config().S3PublishRoots {
|
|
keys = append(keys, k)
|
|
}
|
|
c.JSON(200, keys)
|
|
}
|