The timeouts (SO_SNDTIMEO and SO_RCVTIMEO) set through socket_set_option() in varnish.module:_varnish_terminal_run() doesn't appear to be respected/functional when the varnish host server does not respond/exist.

If you for an example clone your live database to a local development environment, where the IP you have configured is invalid, and forget to disable the varnish module, loading "admin/config" or any other page that leads to commands being ran against varnish will take well over a minute. Being stuck on that socket_connect() call.

This should be improved.

I'd offer up a patch, but I'm close to a deadline and can unfortunately not spare the time right now. IIRC fsockopen() has better timeout handling, alternatively there's a trick temporarily using non-blocking mode with socket_create/socket_connect to check connection status/errors and your own timer. Check this comment on php.net for an example.

Comments

majorrobot’s picture

Priority: Normal » Critical

I'm having the same issue. Changing status to critical, as this can crash (and, in my experience, has crashed) both an application server and Varnish.

My situation was that Varnish was installed, but not yet configured with correct credentials. Drupal continued to ping Varnish on cron until both crashed.

NB: This problem, in connection with http://drupal.org/node/1362576 is especially dangerous. I thought setting Cache Clearing to 'None' would resolve this issue until Varnish was configured. However, 'None' is not being respected.

MiSc’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Closing issues that had no activity the latest year, please re-open if the issues is still relevant.