1

I use WampServer for development testing purposes on my local computer (windows 8). I don't usually turn off the computer, I just close the cover (a laptop) and it sleeps. When I open it again, the server icon in the taskbar is still green, showing that everything is running, but when I try to connect to my server, I get the following error:

Fatal error on line 9 in file C:\...\server\connect.inc 
Error: PDO::__construct(): send of 5 bytes failed with errno=10053 
An established connection was aborted by the software in your host machine.

The error is occurring when I connect to the MySQL server, with the following code:

$conn=new PDO($mysqlhoststring, $mysqlusername, $mysqlpassword, 
        array(PDO::ATTR_PERSISTENT => true));

If I restart all services in WampServer, then it works again.

Any suggestions appreciated.

1 Answer 1

0

When the system goes to sleep it's going to abort connections; perhaps a hibernate would solve the 'status is green but it doesn't work' issue. My guess is that the service is running but some of the connections which aborted on sleep are unaware that they failed on resume.

I would suggest modifying the power settings to keep the laptop on (just turn off display) on lid close actions or, if uptime isn't important, to try hibernating. The first option will prevent the error your are experiencing but will reduce battery life some.

7
  • It's a completely new connection started only after the computer was turned back on. It has no problem connecting to the webserver, only the MySQL server is giving issues. I can't leave it on the whole time - I might leave it overnight, and it's not always plugged in. I don't see how hibernating will help me, either way I'd have to restart the server, no?
    – clum
    May 19, 2015 at 18:49
  • My only thought was that the state that the server comes back from will be slightly different than how it comes back from sleep and that may be enough to resolve the issue. It should come back 'cleaner' from hibernate. Maybe give it a shot?
    – Abraxas
    May 19, 2015 at 18:50
  • 1
    That worked, thanks. I don't have enough reputation on superuser to upvote it...
    – clum
    May 19, 2015 at 19:01
  • No prob, glad it worked. Hibernate takes a bit longer because of how it handles the memory which is active, it's much more reliable than sleep =)
    – Abraxas
    May 19, 2015 at 19:03
  • 1
    I know it takes longer, but it takes even longer to restart wampserver, and almost every time I use the computer I have to use it.
    – clum
    May 19, 2015 at 19:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .