Genserver timeout error on :no_reply response

In other words, when you use handle_call, your caller (the process that calls GenServer.call) expects a reply. One can return {:noreply, state} from handle_call, but only if the reply is computed asynchronously and then sent later with GenServer.reply.

As @rvirding and @kokolegorille wrote, you have two options:

  • Return a simple reply like {:reply, :ok, state}. This ensures that GenServer.call will return :ok only after the operation that you perform in the GenServer completes. This is, generally, the best way, as it ensures that whatever you wanted to execute actually does execute.

  • Alternatively, if you really don’t care about the answer, and also you don’t need to guarantee that the GenServer actually performed the operation, you can use GenServer.cast and handle_cast.