Skip to content

Context has canceled bug Allocate will retry #2736

@alvin-7

Description

@alvin-7

pkg/gameserverallocations/allocator.go 442 lines

func (c *Allocator) allocate(ctx context.Context, gsa *allocationv1.GameServerAllocation) (*agonesv1.GameServer, error) {
	// creates an allocation request. This contains the requested GameServerAllocation, as well as the
	// channel we expect the return values to come back for this GameServerAllocation
	req := request{gsa: gsa, response: make(chan response)}

	// this pushes the request into the batching process
	c.pendingRequests <- req

	select {
	case res := <-req.response: // wait for the batch to be completed
		return res.gs, res.err
	case <-ctx.Done():
-               return nil, errors.New("shutting down")
+               return nil, ErrTotalTimeoutExceeded // or new error state to stop retry
	}
}

What happened:
the context is canceled by kill signal, but allocateFromLocalCluster still retry.

What you expected to happen:
return ErrTotalTimeoutExceeded when context is canceled.

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

Environment:

  • Agones version: latest
  • Kubernetes version (use kubectl version): N/A
  • Cloud provider or hardware configuration:N/A
  • Install method (yaml/helm):N/A
  • Troubleshooting guide log(s):N/A
  • Others:N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions