phpmemadmin icon indicating copy to clipboard operation
phpmemadmin copied to clipboard

Error "110: Connection timed out" while connecting to Memcached on host

Open tchwpkgorg opened this issue 10 years ago • 17 comments

I'm not able to use phpMemAdmin.

It errors with:

PHP Fatal error: Uncaught exception 'Clickalicious\Memcached\Exception' with message 'Error "110: Connection timed out" while connecting to Memcached on host: 10.91.0.114:11211 (UUID: 48cd7fb075b3f332993a1542744836a8c5ce1f4c)' in /usr/local/share/phpmemadmin/vendor/clickalicious/memcached.php/lib/Clickalicious/Memcached/Client.php:908\nStack trace:\n#0 /usr/local/share/phpmemadmin/vendor/clickalicious/memcached.php/lib/Clickalicious/Memcached/Client.php(954): Clickalicious\Memcached\Client->connect('10.91.0.114', '11211')\n#1 /usr/local/share/phpmemadmin/vendor/clickalicious/memcached.php/lib/Clickalicious/Memcached/Client.php(1480): Clickalicious\Memcached\Client->send('stats', 'stats??')\n#2 /usr/local/share/phpmemadmin/lib/Clickalicious/PhpMemAdmin/App.php(2120): Clickalicious\Memcached\Client->stats()\n#3 /usr/local/share/phpmemadmin/lib/Clickalicious/PhpMemAdmin/App.php(1303): Clickalicious\PhpMemAdmin\App->aggregateStatistics(Array)\n#4 /usr/local/share/phpmemadmin/lib/Clickalicious/PhpMemAdmin/App.php(1133): Clickalicious\Ph in /usr/local/share/phpmemadmin/vendor/clickalicious/memcached.php/lib/Clickalicious/Memcached/Client.php on line 908

However, 10.91.0.114:11211 is not refusing connections - anything else except phpMemAdmin is able to connect just fine.

$ telnet 10.91.0.114 11211 Trying 10.91.0.114... Connected to 10.91.0.114. Escape character is '^]'. stats STAT pid 1718 STAT uptime 2786223 STAT time 1423496877 STAT version 1.4.13 STAT libevent 2.0.16-stable STAT pointer_size 64 STAT rusage_user 157.696000 (...)

Also, tcpdump shows that phpMemAdmin is connecting to memcache, immediately disconnecting, and reporting bogus 'Error "110: Connection timed out".

tchwpkgorg avatar Feb 09 '15 15:02 tchwpkgorg

Trying to debug it - is seems it's capable of connecting to localhost, but not to external hosts.

I've used this SSH tunnel to verify it (and changed the host from 10.91.0.114 to 127.0.0.1 in the localhost):

ssh -N -L 11211:10.91.0.114:11211 127.0.0.1 -v

tchwpkgorg avatar Feb 09 '15 15:02 tchwpkgorg

But then, still rendering fatal errors for some requests, i.e.:

[Mon Feb 09 15:54:42.432670 2015] [:error] [pid 27337] [client 106.188.9.189:37893] PHP Fatal error: Uncaught exception 'Clickalicious\Memcached\Exception' with message 'Awaited "VALUE" but received ""' in /usr/local/share/phpmemadmin/vendor/clickalicious/memcached.php/lib/Clickalicious/Memcached/Client.php:1803\nStack trace:\n#0 /usr/local/share/phpmemadmin/vendor/clickalicious /memcached.php/lib/Clickalicious/Memcached/Client.php(2164): Clickalicious\Memcached\Client->parseReadResponse('VALUE TD\Models...', Array)\n#1 /usr/local/share/phpmemadmin/vendor/clickalic ious/memcached.php/lib/Clickalicious/Memcached/Client.php(993): Clickalicious\Memcached\Client->parseResponse('gets', 'VALUE TD\Models...')\n#2 /usr/local/share/phpmemadmin/vendor/clickalic ious/memcached.php/lib/Clickalicious/Memcached/Client.php(1408): Clickalicious\Memcached\Client->send('gets', 'gets TD\Models...')\n#3 /usr/local/share/phpmemadmin/lib/Clickalicious/PhpMe mAdmin/App.php(2286): Clickalicious\Memcached\Client->gets(Array, true)\n#4 /usr/local/share/phpmemadmin/lib/Clickalicious/PhpMemAdmin/App.php(1715): Clickalicious\PhpMemAdmin\App->dum in /usr/local/share/phpmemadmin/vendor/clickalicious/memcached.php/lib/Clickalicious/Memcached/Client.php on line 1803, referer: https://server:444/phpmemadmin/index.php?actio n=2&host=127.0.0.1:11211

when going to "Data".

tchwpkgorg avatar Feb 09 '15 15:02 tchwpkgorg

There are some issues combined i think. I need to check the connection behavior. Currently no clue why it wouldn't connect to another host as localhost. But I will check.

What kind of data do you try to read - can you provide key/value of one recordset as gist or something like that please?

Can you please provide some more environment information:

  • version of memcached (is it the one of your telnet STAT response?)
  • which client was used to write those data Memcached or Memcache Extension?)
  • PHP version
  • OS

Thank you.

benjamin-carl avatar Feb 10 '15 08:02 benjamin-carl

When connecting to remote host with phpmemadmin - I don't try to read any data; just going to phpmemadmin interface gives a blank page (and this error).

When connecting to "localhost" - just going to "Data" in the menu results in a blank page (and an error on the server side). Nothing is displayed.

  • memcached 1.4.13-0ubuntu2.1
  • data was written using php5-memcache
  • php 5.5.9
  • Ubuntu 14.04 64 bit

tchwpkgorg avatar Feb 10 '15 09:02 tchwpkgorg

There was a bug in the client library used by phpMemAdmin.

I've updated this library - Memcached.php - just a few seconds ago. Try to update phpMemAdmin's composer dependencies (Memcached.php) - make sure to use >= v0.3.2

composer update

should do the trick.

Please let me know if the bug is fixed for you too.

benjamin-carl avatar Feb 10 '15 21:02 benjamin-carl

It still crashes for me immediately with "connection timed out" when trying to connect to an external server (just when trying to connect to https://server/phpmemadmin).

tchwpkgorg avatar Feb 11 '15 01:02 tchwpkgorg

Going to "Data" (action=4) - it does not crash immediately anymore. It gets some packets exchanged with memcached, then it stalls. Does not display anything on "Data".

tchwpkgorg avatar Feb 11 '15 01:02 tchwpkgorg

The same error for me Connects fast on localhost, but error on remote And there is no timeout settings..

seyfer avatar Feb 13 '15 09:02 seyfer

Just fix it!

nano /var/www/nesudba2.razlet.ru/vendor/clickalicious/memcached.php/lib/Clickalicious/Memcached/Client.php

and set const DEFAULT_TIMEOUT = 10

seyfer avatar Feb 13 '15 09:02 seyfer

@seyfer @tchwpkgorg This really seems to fix the issue and of course - this makes a lot of sense. Never tested with a remote instance.

Thank you for your contribution. It updated Memcached.php to v0.4.0 which supports runtime configuration of timeout and i also currently working on a fresh phpMemAdmin release to support configurable timeout value to be able to connect to remote instances.

benjamin-carl avatar Feb 15 '15 03:02 benjamin-carl

So guys have a look @ phpMemAdmin v0.3.0 which now requires Memcached.php 0.4.0 Both Libraries where updated this night so the timeout behavior issue was addressed and not it is configurable (.config / .config.dist).

And btw i cleaned the code, added documentation and refactored some parts.

Can you confirm that timeout config will work for you?

benjamin-carl avatar Feb 15 '15 04:02 benjamin-carl

Hi,

thanks for your help.

"Cluster" and "Host" menu options work now for remote hosts.

If I press on "Data" - still no output (just hangs "forever loading").

tchwpkgorg avatar Feb 16 '15 13:02 tchwpkgorg

I will try to simulate some situations with random types of data written by Memcached (PECL) extension and Memcache (PECL) extension so I'm able to handle this correctly and write tests for this cases.

The only thing I need for this is some time :)

benjamin-carl avatar Feb 17 '15 06:02 benjamin-carl

Data still not work

seyfer avatar Aug 18 '15 10:08 seyfer

I am also receiving the same problem. Cannot load data management tab.

equinoxmatt avatar Dec 09 '15 15:12 equinoxmatt

Data still not work

sverdier avatar Aug 23 '16 19:08 sverdier

I am on same issue. It looks like a problem GETS vs GET and maybe some parsing then.

kmajzlik avatar Jan 10 '19 19:01 kmajzlik