mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 01:07:18 +03:00
Create a new grpc exception for each duplicate result [KVL-1099] (#10887)
* Create a new grpc exception for each duplicate result The metadata in the exception is not thread safe, and when being converted into server headers netty.Utils.convertServerHeaders, it calls discardAll which mutates the metadata. Because this was reused for all duplicate exceptions then we got corrupted metadata. CHANGELOG_BEGIN CHANGELOG_END * Do not call duplicate command exception twice
This commit is contained in:
parent
a939594025
commit
e4cce53957
@ -17,7 +17,7 @@ trait ErrorFactories {
|
||||
|
||||
import ErrorFactories._
|
||||
|
||||
lazy val DuplicateCommandException: StatusRuntimeException =
|
||||
def duplicateCommandException: StatusRuntimeException =
|
||||
grpcError(
|
||||
Status
|
||||
.newBuilder()
|
||||
|
@ -17,7 +17,7 @@ class ErrorFactoriesSpec extends AnyWordSpec with Matchers with TableDrivenPrope
|
||||
|
||||
"ErrorFactories" should {
|
||||
"return the DuplicateCommandException" in {
|
||||
val status = StatusProto.fromThrowable(DuplicateCommandException)
|
||||
val status = StatusProto.fromThrowable(duplicateCommandException)
|
||||
status.getCode shouldBe Code.ALREADY_EXISTS.value()
|
||||
status.getMessage shouldBe "Duplicate command"
|
||||
status.getDetailsList.asScala shouldBe Seq(definiteAnswers(false))
|
||||
|
@ -155,8 +155,9 @@ private[apiserver] final class ApiSubmissionService private[services] (
|
||||
}
|
||||
case _: CommandDeduplicationDuplicate =>
|
||||
metrics.daml.commands.deduplicatedCommands.mark()
|
||||
logger.debug(DuplicateCommandException.getMessage)
|
||||
Future.failed(DuplicateCommandException)
|
||||
val exception = duplicateCommandException
|
||||
logger.debug(exception.getMessage)
|
||||
Future.failed(exception)
|
||||
}
|
||||
|
||||
private def handleSubmissionResult(result: Try[state.SubmissionResult])(implicit
|
||||
|
Loading…
Reference in New Issue
Block a user