Skip to content
This repository has been archived by the owner on Jan 23, 2019. It is now read-only.

Compatibility with php gearmanclient #35

Open
websmurf opened this issue Dec 22, 2017 · 2 comments
Open

Compatibility with php gearmanclient #35

websmurf opened this issue Dec 22, 2017 · 2 comments

Comments

@websmurf
Copy link

websmurf commented Dec 22, 2017

Hi

We're currently in the process of migrating our legacy application to a kubernetes cluster with your Gearman server. We running into a weird timeout issue when trying to insert jobs (or a simple ping command from php). It makes me wonder whether if there a reason why the Gearman PECL php package wouldn't work with the Go server?

If I connect to the Gearman server instance from the same pod as the php code is running in through telnet, everything works fine; when trying to run a simple php script against it, it just hangs.

Telnet command & response:

root@test-5cf49f485b-248k9:/var/www# telnet gearmand 4730
Trying 10.99.14.245...
Connected to gearmand.default.svc.cluster.local.
Escape character is '^]'.

php script:

<?php
error_reporting(E_ALL);
ini_set('display_errors', 'on');

$client = new GearmanClient();
$client->addServers('gearmand:4730');

print_r($client->ping('test'));
print_r($client->error());

libgearman version: 1.0.6

When I execute the php script, it just hangs indefiniately. Any idea what this could be?

This is (part of) the output of a strace on the process:

 0.000384 connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.96.0.10")}, 16) = 0
     0.000157 poll([{fd=3, events=POLLOUT}], 1, 0) = 1 ([{fd=3, revents=POLLOUT}])
     0.000237 sendmmsg(3, [{msg_hdr={msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\361\r\1\0\0\1\0\0\0\0\0\0\10gearmand\7default\3sv"..., iov_len=52}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, msg_len=52}, {msg_hdr={msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\r2\1\0\0\1\0\0\0\0\0\0\10gearmand\7default\3sv"..., iov_len=52}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, msg_len=52}], 2, MSG_NOSIGNAL) = 2
     0.000586 poll([{fd=3, events=POLLIN}], 1, 5000) = 1 ([{fd=3, revents=POLLIN}])
     0.000106 ioctl(3, FIONREAD, [68])  = 0
     0.000120 recvfrom(3, "\361\r\205\200\0\1\0\1\0\0\0\0\10gearmand\7default\3sv"..., 2048, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.96.0.10")}, [28->16]) = 68
     0.000335 poll([{fd=3, events=POLLIN}], 1, 4998) = 1 ([{fd=3, revents=POLLIN}])
     0.000117 ioctl(3, FIONREAD, [106]) = 0
     0.000110 recvfrom(3, "\r2\205\200\0\1\0\0\0\1\0\0\10gearmand\7default\3sv"..., 65536, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.96.0.10")}, [28->16]) = 106
     0.000128 close(3)                  = 0
     0.000145 socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, IPPROTO_TCP) = 3
     0.000115 setsockopt(3, SOL_TCP, TCP_NODELAY, [1], 4) = 0
     0.000107 setsockopt(3, SOL_SOCKET, SO_LINGER, {onoff=1, linger=10}, 8) = 0
     0.000169 setsockopt(3, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
     0.000115 setsockopt(3, SOL_SOCKET, SO_SNDBUF, [32768], 4) = 0
     0.000176 setsockopt(3, SOL_SOCKET, SO_RCVBUF, [32768], 4) = 0
     0.000143 connect(3, {sa_family=AF_INET, sin_port=htons(4730), sin_addr=inet_addr("10.99.14.245")}, 16) = -1 EINPROGRESS (Operation now in progress)
     0.000504 poll([{fd=3, events=POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])
     0.000225 sendto(3, "\0REQ\0\0\0\32\0\0\0\nexceptions", 22, MSG_NOSIGNAL, NULL, 0) = 22
     0.000268 recvfrom(3, 0x55aae1dad9b1, 8192, MSG_NOSIGNAL, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
     0.000151 poll([{fd=3, events=POLLIN}], 1, -1

Log on the gearman g2 pod:

I1222 13:45:23.108439       1 session.go:46] new session with sessionId 32 and address: 172.17.0.21:34440
I1222 13:45:23.108499       1 session.go:82] incoming&lt;= sessionId: 32 protocol: PT_OptionReq len(args): 1 details: exceptions
I1222 13:45:23.108503       1 session.go:176] not support type PT_OptionReq
@tamalsaha
Copy link
Member

I am not sure what the problem is. Any chance you can try with the latest version of libgearman http://pecl.php.net/package/gearman ?

@websmurf
Copy link
Author

websmurf commented Jan 3, 2018

Sorry for the delay in response, but it appears to be an issue in the pecl package. With Net_Gearman (https://github.com/brianlmoon/net_gearman) it works alright.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants