Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"An unexpected error occurred" - Every few hits #1285

Closed
cwldev opened this issue Dec 18, 2021 · 5 comments
Closed

"An unexpected error occurred" - Every few hits #1285

cwldev opened this issue Dec 18, 2021 · 5 comments
Labels
Milestone

Comments

@cwldev
Copy link

cwldev commented Dec 18, 2021

How Shlink is set-up

  • Shlink Version: v2.10.0
  • PHP Version: Running in Docker
  • How do you serve Shlink: Docker Image
  • Database engine used: MariaDB
  • Server is behind an nginx proxy (based inside LinuxServer/swag)

Summary

Previous versions appeared to be ok. Started noticing this recently after updates.

Current behavior

Possibly 50% or more of short link hits yield an error "An unexpected error occurred" - on refresh, the link does resolve.

image

Link creation by way of shlink-web encounters no issues creating short links.

Expected behavior

I expect all links to redirect and no errors.

How to reproduce

Not sure as this doesn't appear to be configuration-related.
Perhaps there are some things I could look for?

@cwldev cwldev added the bug label Dec 18, 2021
@acelaya
Copy link
Member

acelaya commented Dec 19, 2021

Could you check the logs around the time this error happens? For the docker image, los are in the standard output.

@acelaya
Copy link
Member

acelaya commented Dec 19, 2021

I have actually managed to reproduce it. I have a suspicion of what could be causing this.

Just to make sure it's the same. Can you check in the logs if you find "MySQL server has gone away"?

@acelaya acelaya added this to the 2.10.1 milestone Dec 19, 2021
@cwldev
Copy link
Author

cwldev commented Dec 20, 2021

Yes, sorry.. there's a lot on the log but I notice the line:

Next Doctrine\DBAL\Exception\ConnectionLost: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away in /etc/shlink/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php:106

And the log ends with:
[2021-12-20T22:23:37.529634+00:00] [496fda53-e901-466e-8273-8d71c6f60588] Access.ERROR - 192.168.1.202 - - "GET /8MrpJ HTTP/1.1" 500 28
[2021-12-20T22:23:37.567762+00:00] [496fda53-e901-466e-8273-8d71c6f60588] Access.INFO - 192.168.1.202 - - "GET /favicon.ico HTTP/1.1" 200 16958

Refresh, link works.

@acelaya
Copy link
Member

acelaya commented Dec 21, 2021

I have found the root cause for this. It's something I already "fixed" several versions ago, but it turns out I only applied a partial fix, mitigating the issue so that it recovers after failing once, instead of preventing the fail completely.

The weird thing is that it has been there since a lot of time ago. It's weird that nobody noticed before.

@acelaya acelaya closed this as completed Dec 21, 2021
@acelaya
Copy link
Member

acelaya commented Dec 21, 2021

I have just released v2.10.1

The docker image will be available once this job finishes: https://github.com/shlinkio/shlink/runs/4595524058?check_suite_focus=true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants