fix(concurrency,durability): address Opus review critical findings

- create_queue: SaveQueue under per-queue lock, not global SyncQueues.Lock
  (fixes fatal concurrent map iteration/write on idempotent CreateQueue of existing FIFO queue)
- delete_message_batch: reject empty ReceiptHandle (JSON protocol bypass deleted all unreceived msgs)
- send_message/send_message_batch: register dedupId only after successful persist
  (retry with same dedupId no longer returns 200 without persisting)
- memory_guard: global HeapAlloc guard (SHARED_SQS_MAX_HEAP_MB, 0=off) in send paths
This commit is contained in:
2026-10-10 17:07:52 +03:00
parent ea7b539d19
commit 521e3d85d0
5 changed files with 80 additions and 12 deletions
+6
View File
@@ -54,6 +54,12 @@ func DeleteMessageBatchV1(req *http.Request) (int, interfaces.AbstractResponseBo
return utils.CreateErrorResponseV1("BatchEntryIdsNotDistinct", true)
}
ids[v.Id] = true
// Пустой ReceiptHandle опасен: в JSON-протоколе (x-amz-json-1.0) он не
// отсекается парсером и совпадает с ReceiptHandle НЕвыданных сообщений (""),
// что удаляло бы все такие сообщения очереди одним запросом.
if v.ReceiptHandle == "" {
return utils.CreateErrorResponseV1("InvalidParameterValue", true)
}
}
queue := models.SyncQueues.GetLocked(key)