shlinkio / shlink

The definitive self-hosted URL shortener
https://shlink.io
MIT License
3.18k stars 255 forks source link

`SQLSTATE[42000]: Syntax error or access violation: 1305 SAVEPOINT DOCTRINE_2 does not exist` when creating short URL using MariaDB/MySQL #2122

Closed cesare190 closed 2 months ago

cesare190 commented 4 months ago

Shlink version

4.1.0

PHP version

8.3.6

How do you serve Shlink

Docker image

Database engine

MariaDB

Database version

10.11.7

Current behavior

If I try to shorten a long link using the command terminal or the web-app the system returns an error, specifically in the web-app an "unknown error" is shown while the terminal gives some additional information which I report below.

sudo docker exec -it shlink short-url:create

In ExceptionConverter.php line 90:

An exception occurred while executing a query: SQLSTATE[42000]: Syntax error or access violation: 1305 SAVEPOINT DOCTRINE_2 does not exist

In Exception.php line 28:

SQLSTATE[42000]: Syntax error or access violation: 1305 SAVEPOINT DOCTRINE_2 does not exist

In Connection.php line 27:

SQLSTATE[42000]: Syntax error or access violation: 1305 SAVEPOINT DOCTRINE_2 does not exist

I tried to change the version of MariaDB by trying to do downgrades without success. Authentication to the database seems to occur without problems, the redirects assigned to alternative domains to the main one via the respective cli commands and subsequently modifying them via the web-app work correctly. I currently use Nginx Proxy Manager as a reverse proxy.

Expected behavior

Normally I would expect to be able to generate error-free links via the terminal or via the web-app

Minimum steps to reproduce

To create my Shlink environment in Docker you can use this Stack:

version: '3.8' services: shlink: container_name: shlink-web hostname: shlink-web image: 'shlinkio/shlink:latest' restart: unless-stopped networks:

networks: default: driver: bridge webbridge: external: true

.env:

DEFAULT_DOMAIN=defaultlink IS_HTTPS_ENABLED=true DB_DRIVER=maria DB_USER=shlink DB_PASSWORD=userpassword DB_HOST=shlink-db

Once the two containers have started, it will then be necessary to create an api-key to interact via the web-app. From the terminal this command will return no errors and will work as usual. Instead, creating shortened links should return the error reported above. The way to shorten the links does not change the result but the reason for the error will be returned from the terminal, which does not happen via the web-app.

acelaya commented 4 months ago

Seems to be a bug in Shlink's ORM https://github.com/doctrine/orm/issues/11230. Let's wait for them to fix and I'll release a patch afterwards.

acelaya commented 4 months ago

In the meantime, that issue mentions something about disabling "savepoints" (not sure what that is) in MySQL. Maybe that's something you can try.

acelaya commented 2 months ago

This doesn't seem to be getting too much attention in upstream project, not affecting anyone else.

I'll close this until any of those change.