On some systems (e.g. my MacOS laptop with a custom Varnish build for testing), PHP will not release the socket fast enough after writing data to the control terminal. Previously I have used a 50ms pause — usleep(50) — between the write and the read in order to compensate this.

A better answer is to give the socket read function the ability to recursively retry if it gets the "temporarily unavailable" error response (code 35).

Attached is a first attempt at adding this capability.

Comments

fabsor’s picture

Status: Active » Needs review

I looked around for an option to set on the socket that could help, but there doesn't seem to be any good ones, so this looks like a good approach to me. I'm setting this to needs review, I will also test this a little more in depth later.

joshk’s picture

Agreed on needing more testing. I also feel the recursion itself could be more elegant.

fabsor’s picture

StatusFileSize
new1.25 KB

The tests run fine with this patch. The attached patch just contains some cosmetic changes.

rjbrown99’s picture

I get a number of those temp unavailable messages, despite a high timeout. I popped in #3, we'll see how it goes.

helmo’s picture

Only minor merge fix was needed when I applied this after #1089878: Make it possible to execute more than one command in one connection.

Simpletest succeeds and basic functioning seems ok.

fabsor’s picture

Issue tags: +Release blocker

@helmo Thanks for the review! This makes us a bit closer to a release, and that's really appreciated!

@rjbrown99 Did the patch work for you? I have never experienced this errors on any of my machines and I would really like to get this in so that we can release the first real release of this module, and this is one of the blockers currently =)

rjbrown99’s picture

I suspect this helped things quite a bit. I also made Varnish changes to the VCL, specifically to better handle POSTs. I posted about it here:

http://groups.drupal.org/node/28604#comment-496214

fabsor’s picture

Status: Needs review » Fixed

This issue is a tough one to determine if it's fixed or not, but since it does not break anything and might improve the situation for certain users, I deem this issue fixed. Commited to head.

Thanks everyone who took the time to review and test, it is really appreciated!

Status: Fixed » Closed (fixed)
Issue tags: -Release blocker

Automatically closed -- issue fixed for 2 weeks with no activity.