momentum-mod / website

Momentum Mod's main website.
https://momentum-mod.org
MIT License
57 stars 60 forks source link

Prisma transaction can expire during map submission #998

Open sentry-io[bot] opened 1 month ago

sentry-io[bot] commented 1 month ago

I'm assuming we're keeping a transaction open for the lifetime of an S3 operation here, I think the image uploads. Not good!

Sentry Issue: BACKEND-1J

PrismaClientKnownRequestError: Transaction API error: Transaction already closed: A commit cannot be executed on an expired transaction. The timeout for this transaction was 5000 ms, however 6623 ms passed since the start of the transaction. Consider increasing the interactive tra...
  File "/app/main.js", line 11171, in MapsService.submitMapSubmissionVersion
    await this.db.$transaction(async (tx) => {
GordiNoki commented 1 month ago

Images are not uploaded during this transaction. I believe it's VMFs that took most time to upload. I'm not sure how precise is information in sentry's breadcrumbs, but VMFs PUT request is what happened 5 seconds before error, so I believe this is what resulted in transaction timeout. The solution would be probably to do s3 operations separately from db transaction