openfoodfacts / openfoodfacts-query

This extracts key product data from MongoDB into a Postgres database to speed up OFF
GNU Affero General Public License v3.0
1 stars 0 forks source link

Problem with transaction handling #43

Closed alexgarel closed 4 months ago

alexgarel commented 4 months ago

In docker compose logs query

got a lot of:

query-1  | error: select count(*) count from "query"."product" as "pt" where (not pt.obsolete) and (EXISTS (select "pt2".* from "query"."product_brands_tag" as "pt2" where "pt2"."product_id" = "pt"."id" and "pt2"."value" = 'twinings')) and (EXISTS (select "pt2".* from "query"."product_entry_dates_tag" as "pt2" where "pt2"."product_id" = "pt"."id" and "pt2"."value" = '2018-09-21')) - current transaction is aborted, commands ignored until end of transaction block
query-1  |     at Parser.parseErrorMessage (/node_modules/pg-protocol/dist/parser.js:287:98)
query-1  |     at Parser.handlePacket (/node_modules/pg-protocol/dist/parser.js:126:29)
query-1  |     at Parser.parse (/node_modules/pg-protocol/dist/parser.js:39:38)
query-1  |     at Socket.<anonymous> (/node_modules/pg-protocol/dist/index.js:11:42)
query-1  |     at Socket.emit (node:events:518:28)
query^Cquery-1  | [Nest] 1  - 04/16/2024, 7:00:20 PM   ERROR [ExceptionsHandler] select count(*) count from "query"."product" as "pt" where (not pt.obsolete) and (EXISTS (select "pt2".* from "query"."product_ingredients_tag" as "pt2" where "pt2"."product_id" = "pt"."id" and "pt2"."value" = 'en:longan')) and (EXISTS (select "pt2".* from "query"."product_countries_tag" as "pt2" where "pt2"."product_id" = "pt"."id" and "pt2"."value" = 'en:taiwan')) - current transaction is aborted, commands ignored until end of transaction block

Maybe we should switch to opening a new transaction on each new request.

alexgarel commented 4 months ago

I restarted the docker in production for now, but there is a high risks it will come back.