GEARMAN_RETURN_T(3)

✨ GEARMAN_RETURN_T ✨

okay bestie, you're in section 3 of the manual (that's the library-functions girlies πŸ’…), and this page is literally the entire encyclopedia of "what does this return value even MEAN" for Gearmand. Grab a snack. πŸ“


🌸 NAME 🌸

gearman_return_t β€” it's the Gearmand documentation situation, findable over at http://gearman.info/ πŸ¦‹


πŸŽ€ SYNOPSIS πŸŽ€

#include <libgearman/gearman.h>

type gearman_return_t

const char *gearman_strerror(gearman_return_t rc)

bool gearman_success(gearman_return_t rc)

bool gearman_failed(gearman_return_t rc)

bool gearman_continue(gearman_return_t rc)

and when you compile, you link it up with -lgearman β€” no skipping this part, babes, it will simply not work 😭


πŸ’– DESCRIPTION πŸ’–

So gearman_return_t is THE return/error type for basically every call you make against gearman_client_st and gearman_worker_st. Like, every single one. It's giving main character energy.

When things go right, you get GEARMAN_SUCCESS. When they don't, you get an error back instead. Want to check whether what you got is one of the sad ones? gearman_failed() is your girl for exactly that. And if you want the error message to actually be readable instead of just a bare code, gearman_strerror() will hand you a text version. 🫢

Here's the little trio explained properly:

  • gearman_success() returns true if it's GEARMAN_SUCCESS, or if GEARMAN_NO_PENDING_TASKS tests true. Both count, periodt.
  • gearman_failed() returns true if literally any value other than GEARMAN_SUCCESS was passed in. Not picky. Just disappointed.
  • gearman_continue() returns true if any error related to non-blocking IO happened. This is the one you use for testing loops. iykyk πŸ”₯

πŸ‘‘ Possible values of gearman_return_t πŸ‘‘

  • GEARMAN_SUCCESS β€” Success. The slay. Everything worked. ✨
  • GEARMAN_NO_PENDING_TASKS β€” gearman_client_run_tasks() was called, and it has completed all the tasks assigned to the client. Nothing left in the queue, bestie.
  • GEARMAN_IO_WAIT β€” Blocking IO was found. You can use gearman_continue() to test for this one.
  • GEARMAN_ERRNO β€” A system error occurred. Go check either gearman_client_errno() or gearman_worker_errno() depending on who you are in this situation πŸ’€
  • GEARMAN_NO_ACTIVE_FDS β€” No active connections were available. Yeah, gearman_continue() can test for this too.
  • GEARMAN_GETADDRINFO β€” Name resolution failed for a host. DNS said no. πŸ₯²
  • GEARMAN_NO_SERVERS β€” No servers have been provided for the client/worker. You didn't tell it where to go, babe.
  • GEARMAN_LOST_CONNECTION β€” Connection was lost to the given server. It ghosted you. 😭
  • GEARMAN_MEMORY_ALLOCATION_FAILURE β€” Memory allocation failed. Out of room, no cap.
  • GEARMAN_SERVER_ERROR β€” An error occurred on the server. Not your fault, the server's just having a day.
  • GEARMAN_NOT_CONNECTED β€” Client/Worker is not currently connected to the server.
  • GEARMAN_COULD_NOT_CONNECT β€” Server name was valid, but a connection could not be made. The address was cute but it just didn't answer. πŸ™ˆ
  • GEARMAN_ECHO_DATA_CORRUPTION β€” Either gearman_client_echo() or gearman_worker_echo()'s echo was unsuccessful, because the data came back from gearmand corrupted. Rude.
  • GEARMAN_UNKNOWN_STATE β€” The gearman_return_t was never set. Mystery value, no thoughts, head empty.
  • GEARMAN_FLUSH_DATA β€” Internal state, and it should never be seen by either a client or a worker. If you see it, something is deeply weird. 🚩
  • GEARMAN_SEND_BUFFER_TOO_SMALL β€” Send buffer was too small. Not enough room to fit the vibe.
  • GEARMAN_TIMEOUT β€” A timeout occurred when making a request to the server.
  • GEARMAN_ARGUMENT_TOO_LARGE β€” The argument was too large for the current buffer.
  • GEARMAN_INVALID_ARGUMENT β€” One of the arguments to the given API call was invalid. Heads up: EINVAL will be set if gearman_client_error() or gearman_worker_error() were not settable. This can also be returned if GEARMAN_CLIENT_UNBUFFERED_RESULT was set, but the client is not handling the data correctly. Two very different crimes, same code. 😡

🌈 CLIENT ONLY 🌈

  • GEARMAN_NEED_WORKLOAD_FN β€” A client was asked for work, but no gearman_workload_fn callback was specified. See gearman_client_set_workload_fn(). You forgot the callback, bestie, it happens.
  • GEARMAN_WORK_FAIL β€” A task has failed, and the worker has exited with an error, or it called gearman_job_send_fail().
  • GEARMAN_IN_PROGRESS β€” gearman_client_job_status() has been called for a gearman_job_handle_t, and the Job is currently being run by a worker. It's busy. It's in its era.
  • GEARMAN_JOB_EXISTS β€” gearman_client_job_status() has been called for a gearman_job_handle_t, and the Job is currently known by a server, but is not being run by a worker. It exists, it's just unemployed.

πŸ¦‹ WORKER ONLY πŸ¦‹

  • GEARMAN_INVALID_FUNCTION_NAME β€” A worker was sent a request for a job that it did not have a valid function for.
  • GEARMAN_INVALID_WORKER_FUNCTION β€” No callback was provided by the worker for a given function.
  • GEARMAN_NO_REGISTERED_FUNCTION β€” A request for removing a given function from a worker was invalid, since that function did not exist. Can't un-register what was never registered πŸ’…
  • GEARMAN_NO_REGISTERED_FUNCTIONS β€” The worker has not registered any functions. Zero. Nada. Empty roster.
  • GEARMAN_NO_JOBS β€” No jobs were found for the worker. Important detail: this error code is only returned if the worker has just made a request for jobs.

πŸ’œ WORKER TO CLIENT πŸ’œ

Clients which have registered a custom gearman_actions_t may use these values as return values to the calling client. Yes, you read that right β€” these travel upstream. 🌊

  • GEARMAN_WORK_DATA β€” Worker has sent a chunked piece of data to the client via gearman_job_send_data().
  • GEARMAN_WORK_WARNING β€” Worker has issued a warning to the client via gearman_job_send_warning().
  • GEARMAN_WORK_STATUS β€” Status has been updated by the worker via gearman_job_send_status().
  • GEARMAN_WORK_EXCEPTION β€” Worker has sent an exception to the client via gearman_job_send_exception(). Drama, but the valid kind.
  • GEARMAN_WORK_FAIL β€” A task has failed, and the worker has exited with an error, or it called gearman_job_send_fail().
  • GEARMAN_WORK_ERROR β€” A task has had an error and will be retried. It's not over, it's just not now.
  • GEARMAN_PAUSE β€” Used only in a custom application, for a client return based on GEARMAN_WORK_DATA, GEARMAN_WORK_WARNING, GEARMAN_WORK_EXCEPTION, GEARMAN_WORK_FAIL, or GEARMAN_WORK_STATUS. gearman_continue() can be used to check for this value.

πŸ’œ WORKER TO CLIENT πŸ’œ (yes, again, it's a whole other list)

Any function defined by gearman_worker_define_function() may, and can only, return the following gearman_return_t values. That's the whole menu, okay? No substitutions. πŸŽ€

  • GEARMAN_SUCCESS β€” The function successfully completed the job. ate, no crumbs. πŸ‘‘
  • GEARMAN_FATAL
  • GEARMAN_FAIL β€” The function failed to complete the job. Fun fact: GEARMAN_FATAL is the deprecated name for GEARMAN_FAIL.
  • GEARMAN_ERROR β€” A task has had an error and will be retried.
  • GEARMAN_SHUTDOWN β€” GEARMAN_SHUTDOWN is a special case. If it is returned, the client will be sent GEARMAN_SUCCESS, but gearman_worker_work() will exit with GEARMAN_SHUTDOWN. Wild, I know, but that's literally the documented behaviour. πŸ”₯

🧚 TASK ONLY 🧚

  • GEARMAN_NOT_FLUSHING β€” gearman_task_send_workload() failed, because it was not in the correct state.
  • GEARMAN_DATA_TOO_LARGE β€” gearman_task_send_workload() failed, because the data was too large to be sent.
  • GEARMAN_UNKNOWN_OPTION β€” Default state of a task return value. The "we haven't decided yet" of it all.

⭐ PROTOCOL ⭐

Heads up bestie: if any of these errors occurred, the connection will be dropped/reset. That is not a drill. πŸ’€
  • GEARMAN_INVALID_MAGIC
  • GEARMAN_INVALID_COMMAND
  • GEARMAN_INVALID_PACKET
  • GEARMAN_UNEXPECTED_PACKET
  • GEARMAN_TOO_MANY_ARGS

πŸ’€ DEPRECATED πŸ’€

  • GEARMAN_IGNORE_PACKET
  • GEARMAN_MAX_RETURN
Please don't build anything new on these, bestie. They're the old era, and we've moved on. 🫢

🌟 SEE ALSO 🌟

gearmand(8) libgearman(3) gearman_client_error() or gearman_worker_error()


🫢 Author 🫢

Data Differential http://www.datadifferential.com/


2011-2014, Data Differential, http://www.datadifferential.com/


okay that's literally the whole page, slay πŸ’… this was gearmand version 1.1.21+ds, dated Feb 04, 2026 β€” go forth and check your return values, bestie, and remember: GEARMAN_SUCCESS or it didn't happen βœ¨πŸ’–πŸŒˆ

πŸ“¦ where this page comes from