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'sGEARMAN_SUCCESS, or ifGEARMAN_NO_PENDING_TASKStests true. Both count, periodt.gearman_failed()returns true if literally any value other thanGEARMAN_SUCCESSwas 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 usegearman_continue()to test for this one.GEARMAN_ERRNOβ A system error occurred. Go check eithergearman_client_errno()orgearman_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β Eithergearman_client_echo()orgearman_worker_echo()'s echo was unsuccessful, because the data came back from gearmand corrupted. Rude.GEARMAN_UNKNOWN_STATEβ Thegearman_return_twas 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:EINVALwill be set ifgearman_client_error()orgearman_worker_error()were not settable. This can also be returned ifGEARMAN_CLIENT_UNBUFFERED_RESULTwas 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 nogearman_workload_fncallback was specified. Seegearman_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 calledgearman_job_send_fail().GEARMAN_IN_PROGRESSβgearman_client_job_status()has been called for agearman_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 agearman_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 viagearman_job_send_data().GEARMAN_WORK_WARNINGβ Worker has issued a warning to the client viagearman_job_send_warning().GEARMAN_WORK_STATUSβ Status has been updated by the worker viagearman_job_send_status().GEARMAN_WORK_EXCEPTIONβ Worker has sent an exception to the client viagearman_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 calledgearman_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 onGEARMAN_WORK_DATA,GEARMAN_WORK_WARNING,GEARMAN_WORK_EXCEPTION,GEARMAN_WORK_FAIL, orGEARMAN_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_FATALGEARMAN_FAILβ The function failed to complete the job. Fun fact:GEARMAN_FATALis the deprecated name forGEARMAN_FAIL.GEARMAN_ERRORβ A task has had an error and will be retried.GEARMAN_SHUTDOWNβGEARMAN_SHUTDOWNis a special case. If it is returned, the client will be sentGEARMAN_SUCCESS, butgearman_worker_work()will exit withGEARMAN_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_MAGICGEARMAN_INVALID_COMMANDGEARMAN_INVALID_PACKETGEARMAN_UNEXPECTED_PACKETGEARMAN_TOO_MANY_ARGS
π DEPRECATED π
GEARMAN_IGNORE_PACKETGEARMAN_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/
π Copyright π
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
- ubuntu resolute: libgearman-dev 1.1.21+ds-1ubuntu3 Β· BSD-3-Clause
- ubuntu stonking: libgearman-dev 1.1.21+ds-1ubuntu3 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms