質問

I used Homebrew to do all my installs but am having some trouble here...

So I have a PHP application that for whatever reason uses both the "memcache" and "memcached" modules. Whatever.

System is OS X Lion, 10.7.4. Apache is the stock one Apple ships with the OS, Apache/2.2.21. I'm using PHP 5.3.14 from Homebrew.

I install everything I need:

brew install libmemcached memcached php53 php53-memcache php53-memcached

And configure things -- set up Apache httpd.conf to point to the PHP .so file, and add the memcache and memcached extensions to my php.ini

I load my application... and it crashes httpd!

Here's the crash dump I get(long dump): https://gist.github.com/3125309

If I brew uninstall libmemcached and bounce httpd, I can then access my application fine, however memcached isn't actually working because it (dur) can't find libmemcached.

I'd really like to get memcached working properly locally but I'm not sure what's going on here. It's only an issue from PHP; I can use Python's python-memcached module to access it just fine(but I'm not sure if that uses libmemcached).

Any thoughts? I'm not seeing anything that looks helpful in the crash dump :(

EDIT: Ah, the line number WAS helpful! Here's the block of the associated libmemcached source:

  #ifdef HAVE_SNDTIMEO
  if (server->root->snd_timeout)
  {
    struct timeval waittime;

    waittime.tv_sec= 0;
    waittime.tv_usec= server->root->snd_timeout;

    int error= setsockopt(server->fd, SOL_SOCKET, SO_SNDTIMEO,
                      &waittime, (socklen_t)sizeof(struct timeval));
    assert(error == 0); 
  }
#endif

So it sounds like a timeout issue? But my memcached is on localhost, it shouldn't time out... unless it's not trying to connect to the correct server possibly.

Still, why should this cause a complete httpd crash?

EDIT2: I re-compiled with SNDTIMEO and RCVTIMEO both disabled and now I'm happily up and running... but still, A) why did the configure script determine those could be enabled and B) why did it cause an httpd crash?

役に立ちましたか?

解決

I was able to resolve this by building my own libmemcached, with the bits of code reliant on RCVTIMEO and SNDTIMEO removed, and then building php-memcached against that custom libmemcached.

I am still not sure why my system reports SNDTIMEO and RCVTIMEO are available to the libmemcached configure script when they don't work. This makes the OS X homebrew version unusable for me. I am surprised other people haven't encountered this issue.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top