Skip to content

Instantly share code, notes, and snippets.

@s0enke

s0enke/gist:1397483

Created Nov 27, 2011
Embed
What would you like to do?
gearman client endlessloop
gearman versions:
$ dpkg -l *gearman* | grep ^ii
ii gearman-job-server 0.13-1 Job server for the Gearman distributed job queue
ii gearman-tools 0.13-1 Tools for the Gearman distributed job queue
ii libgearman-dbg 0.13-1 Debug symbols for the Gearman Client Library
ii libgearman4 0.13-1 Library providing Gearman client and worker func
sometimes my gearman php client gets into an endless loop:
strace:
poll([{fd=8, events=POLLOUT}], 1, 10000) = 1 ([{fd=8, revents=POLLERR|POLLHUP}])
poll([{fd=8, events=POLLOUT}], 1, 10000) = 1 ([{fd=8, revents=POLLERR|POLLHUP}])
poll([{fd=8, events=POLLOUT}], 1, 10000) = 1 ([{fd=8, revents=POLLERR|POLLHUP}])
poll([{fd=8, events=POLLOUT}], 1, 10000) = 1 ([{fd=8, revents=POLLERR|POLLHUP}])
poll([{fd=8, events=POLLOUT}], 1, 10000) = 1 ([{fd=8, revents=POLLERR|POLLHUP}])
poll([{fd=8, events=POLLOUT}], 1, 10000) = 1 ([{fd=8, revents=POLLERR|POLLHUP}])
poll([{fd=8, events=POLLOUT}], 1, 10000) = 1 ([{fd=8, revents=POLLERR|POLLHUP}])
poll([{fd=8, events=POLLOUT}], 1, 10000) = 1 ([{fd=8, revents=POLLERR|POLLHUP}])
poll([{fd=8, events=POLLOUT}], 1, 10000) = 1 ([{fd=8, revents=POLLERR|POLLHUP}])
this is a socket:
$ l /proc/15007/fd/8
lrwx------ 1 www-data www-data 64 2011-11-27 05:53 /proc/15007/fd/8 -> socket:[1763846792]
lsof says:
$ lsof -p 15007 | grep 1763846792
php5 15007 www-data 8u sock 0,4 1763846792 can't identify protocol
gdb says:
(gdb) bt
#0 0x00007f2312583bd6 in poll () from /lib/libc.so.6
#1 0x00007f230df60f5d in gearman_wait (universal=0x2b33ac8) at libgearman/universal.c:248
#2 0x00007f230df59277 in gearman_client_run_tasks (client=0x2b33a38) at libgearman/client.c:871
#3 0x00007f230df5a8c4 in _client_do_background (client=0x2b33a38, command=GEARMAN_COMMAND_SUBMIT_JOB_BG, function_name=0x0, function_name_length=4, unique=<value optimized out>,
unique_length=<value optimized out>, workload=0x2fedac8, workload_size=885, job_handle=0x2ff1668 "") at libgearman/client.c:1373
#4 0x00007f230df5ab4d in gearman_client_do_background (client=0x2b33a38, function_name=0x2fc12f8 "rmi", unique=0x0, workload=0x2fedac8, workload_size=885, job_handle=<value optimized out>)
at libgearman/client.c:366
#5 0x00007f230e176978 in zif_gearman_client_do_background () from /usr/lib/php5/20060613/gearman.so
@s0enke

This comment has been minimized.

Copy link
Owner Author

@s0enke s0enke commented Nov 27, 2011

the code is:

  while (1)
  {
    ret= poll(pfds, x, universal->timeout);
    if (ret == -1)
    {
      if (errno == EINTR)
        continue;

      gearman_universal_set_error(universal, "gearman_wait", "poll:%d", errno);
      universal->last_errno= errno;
      return GEARMAN_ERRNO;
    }

    break;
  }

So errno must be EINTR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment