There is already an active transaction error (500) when adding multiple documents
- 0
- Databases
- Self Hosted

I'm trying to remove this entity from web console

and after restart - first try produces this error:
[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

Full log with comment:
[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

tbh database is unusable

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

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

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

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

same relationship attribute does not have this problem

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

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

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

Relationships feature is experimental

true, let's help to improve it

I isolated 100% repro database schema


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

then try to remove document in collection c

voila

[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

and on every another
[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

tried on the new project

Bump

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

yes
Recommended threads
- Offline replication with RXDB
Hey there! Trying out apprwrite with rxdb for an offline focussed application. I cannot seem to find on how to set the permissions on a per document level?
- How to Fetch Item and Include the User/A...
A typical workflow with ORMs is to, for example, fetch an item from the DB and include the user who created it. How would I do that with AppWrite? Is that easil...
- Unable to add permission when creating a...
I am creating a collection from a cloud function using the Appwrite Dart server SDK, and I want to add permissions so it can be accessed by users. I added code ...
