Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3210538
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T14:34:49+00:00 2026-05-17T14:34:49+00:00

What exactly happens when the database attached to symfony goes offline or is unreachable?

  • 0

What exactly happens when the database attached to symfony goes offline or is unreachable? Maybe the answer to this question is in my face and I don’t realize it, but I’ve been searching for the last while and still coming up empty handed.

I’ve attempted to simulate this myself (in the “production” environment) by just stopping the database service (I’m developing on my Windows laptop–deploying on a LAMP server), but it just sat there until it exceeded the PHP execution time limit.

I’m running symfony 1.4 with Doctrine. One would assume that it would throw some sort of catchable exception or maybe even be able to set a connection timeout and then throw an exception. I can’t help but cringe at the thought of a customer just sitting there for 30 seconds waiting on a database query to finish that will never happen.

If there isn’t any preventative measures already in the symfony core, can anyone make any suggestions on how they handle it? I’ll of course have a heartbeat monitor on the database, but if it goes down the site needs to be taken down, too.

Update: Threw together a test script to just connect to the localhost database via Mysqli and it still reached the maximum execution time. However, it did throw a warning for the failed connection.

— Logan

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T14:34:49+00:00Added an answer on May 17, 2026 at 2:34 pm

    It depends. If the site is being accessed in the “dev” environment, it will give you a 500 internal server error with a message like this: “PDO Connection Error: SQLSTATE[HY000] [2002] Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)”
    and a stack trace below that (like normal Exceptions in Symfony).

    If you access the site in the “prod” environment you just get the standard (or custom if you’ve created one for 500 errors): “Oops! An Error Occurred
    The server returned a ‘500 Internal Server Error’.” Without a stack trace.

    In either case, it is an Exception being thrown (that is catchable). It’s a Doctrine_Connection_Exception. You would likely want to try/catch this exception around a call to a model’s save() method.

    I’m not sure why it is taking so long and just timing out though, when I attempt it on my laptop locally, it returns the error almost immediately.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I hope this is programming-related enough. What exactly happens during the shutdown process of
I'm sorry if this seems like a random question, but I have a database
What exactly happens, in terms of memory, when i declare something like: char arr[4];
I have the following issue and I would like to know what exactly happens.
What happens exactly when I launch a .NET exe? I know that C# is
Does anyone know exactly what happens when you change your Zend site at, say,
Exactly what the title says...........any thoughts on other good options for relational database implementation
I am reading data from an sql database and the connection happens but the
Here's the problem: When a script starts modifying the database and something goes wrong,
What exactly happens when I call Session.flush() on an open hibernate session? Are all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.