Back

There is already an active transaction error (500) when adding multiple documents

  • 0
  • Databases
  • Self Hosted
obiwanzenobi
3 Oct, 2023, 07:36

I'm trying to remove this entity from web console

TL;DR
The user is experiencing an error (500) when attempting to add multiple documents. The error message indicates that there is already an active transaction and there is an unknown PDO type for an object. One user suggests that the issue may be related to the relationship attribute and recommends removing the relationship within the collection. Another user mentions that they were able to solve the issue by removing the relationship attribute. The user experiencing the issue plans to isolate and reproduce the bug to provide steps for debugging.
obiwanzenobi
3 Oct, 2023, 07:37

and after restart - first try produces this error:

TypeScript
[Error] Timestamp: 2023-10-03T07:36:51+00:00
[Error] Method: DELETE
[Error] URL: /v1/databases/:databaseId/collections/:collectionId/documents/:documentId
[Error] Type: Utopia\Database\Exception
[Error] Message: Unknown PDO Type for object
[Error] File: /usr/src/code/vendor/utopia-php/database/src/Database/Adapter/MariaDB.php
[Error] Line: 1424
[Error] Timestamp: 2023-10-03T07:36:53+00:00
obiwanzenobi
3 Oct, 2023, 07:44

Full log with comment:

TypeScript
[2023-10-03 07:40:27 $1.0]    INFO    Server is shutdown now
Worker 3 started successfully
Worker 2 started successfully
Worker 4 started successfully
Worker 5 started successfully
Worker 7 started successfully
Worker 6 started successfully
Worker 8 started successfully
Worker 9 started successfully
Worker 10 started successfully
Worker 11 started successfully
Worker 12 started successfully
[Setup] - Server database init started...
[Setup] - Creating database: appwrite...
[Setup] - Server database init completed...
Server started successfully (max payload is 6,291,456 bytes)
Master pid 1, manager pid 1
Worker 1 started successfully
[Error] Timestamp: 2023-10-03T07:41:31+00:00
[Error] Method: DELETE
[Error] URL: /v1/databases/:databaseId/collections/:collectionId/documents/:documentId
[Error] Type: Utopia\Database\Exception
[Error] Message: Unknown PDO Type for object
[Error] File: /usr/src/code/vendor/utopia-php/database/src/Database/Adapter/MariaDB.php
[Error] Line: 1424
[Error] Timestamp: 2023-10-03T07:41:50+00:00
[Error] Method: DELETE
[Error] URL: /v1/databases/:databaseId/collections/:collectionId/documents/:documentId
[Error] Type: PDOException
[Error] Message: There is already an active transaction
[Error] File: @swoole-src/library/core/Database/PDOProxy.php
[Error] Line: 41

so after docker compose restart, first try is to delete comment entity (unknown PDO type) and second one is after trying to delete anything else (even without relations) - there is already active transaction

obiwanzenobi
3 Oct, 2023, 07:45

tbh database is unusable

Drake
3 Oct, 2023, 14:28

This has been an elusive bug for us. It would help if we could get reproducible steps

obiwanzenobi
3 Oct, 2023, 15:21

Ok, I will try to isolate it - because we have 100% repro situation there

Drake
3 Oct, 2023, 19:44

if you can reproduce it with a new project, you can provide us with those exact steps and then we can try to reproduce it on our end

obiwanzenobi
8 Oct, 2023, 21:41

This time we solved it by removing relationship within this collection. I tried to reproduce it this weekend but without success.

obiwanzenobi
8 Oct, 2023, 21:47

same relationship attribute does not have this problem

obiwanzenobi
17 Oct, 2023, 09:20

Got it again, I will do a backup tonight, clean user and customer data, and I will be able to give you access to broken instance

hcraige
17 Oct, 2023, 10:27

not my thread but does that mean that the relationship attribute is buggy and was the actual issue throwing the errors? I know one can still link tables otherwise, however it's so convenient to use (makes development easier) - need to check one more time from others first

Guille
17 Oct, 2023, 11:48

I've been trying to reproduce this bug too, do you have more than one relationship attribute, I believe this happen when you remove a parent document, having childs referenced on it. I'm not totally sure, but maybe you can share what are you doing to see if is something similar to my setup

Drake
17 Oct, 2023, 22:51

Relationships feature is experimental

obiwanzenobi
20 Oct, 2023, 23:54

true, let's help to improve it

obiwanzenobi
20 Oct, 2023, 23:55

I isolated 100% repro database schema

obiwanzenobi
20 Oct, 2023, 23:55
obiwanzenobi
20 Oct, 2023, 23:57

add anything to collection a add anything to collection b add document to collection c with id of document from collection b (probably not related) add document to collection d that has relationship to document from c and a second relationship to document from a

obiwanzenobi
20 Oct, 2023, 23:57

then try to remove document in collection c

obiwanzenobi
20 Oct, 2023, 23:57

voila

obiwanzenobi
20 Oct, 2023, 23:59
TypeScript
[Error] Timestamp: 2023-10-20T23:58:30+00:00
[Error] Method: DELETE
[Error] URL: /v1/databases/:databaseId/collections/:collectionId/documents/:documentId
[Error] Type: Utopia\Database\Exception
[Error] Message: Unknown PDO Type for object
[Error] File: /usr/src/code/vendor/utopia-php/database/src/Database/Adapter/MariaDB.php
[Error] Line: 1427

for the first try

obiwanzenobi
21 Oct, 2023, 00:00

and on every another

TypeScript
[Error] Timestamp: 2023-10-20T23:59:15+00:00
[Error] Method: DELETE
[Error] URL: /v1/databases/:databaseId/collections/:collectionId/documents/:documentId
[Error] Type: PDOException
[Error] Message: There is already an active transaction
[Error] File: @swoole-src/library/core/Database/PDOProxy.php
[Error] Line: 41
obiwanzenobi
21 Oct, 2023, 00:00

tried on the new project

obiwanzenobi
30 Oct, 2023, 23:45

Bump

Drake
31 Oct, 2023, 00:38

This sounds the same as this issue, right? https://github.com/appwrite/appwrite/issues/5850

obiwanzenobi
31 Oct, 2023, 10:08

yes

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more