mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
fn: Remove error channel for container exits (#1287)
The channel is unnecessary and unreliable since exits trigger I/O failure on UDS earlier than we detect the exit.
This commit is contained in:
@@ -555,7 +555,6 @@ func (a *agent) waitHot(ctx context.Context, call *call) (Slot, error) {
|
||||
// implements Slot
|
||||
type hotSlot struct {
|
||||
done chan struct{} // signal we are done with slot
|
||||
errC <-chan error // container error
|
||||
container *container // TODO mask this
|
||||
cfg *Config
|
||||
udsClient http.Client
|
||||
@@ -599,9 +598,6 @@ func (s *hotSlot) exec(ctx context.Context, call *call) error {
|
||||
errApp := s.dispatch(ctx, call)
|
||||
|
||||
select {
|
||||
case err := <-s.errC: // error from container
|
||||
s.trySetError(err)
|
||||
return err
|
||||
case err := <-errApp: // from dispatch
|
||||
if err != nil {
|
||||
if models.IsAPIError(err) {
|
||||
@@ -814,9 +810,6 @@ func (a *agent) runHot(ctx context.Context, call *call, tok ResourceToken, state
|
||||
return
|
||||
}
|
||||
|
||||
// buffered, in case someone has slot when waiter returns but isn't yet listening
|
||||
errC := make(chan error, 1)
|
||||
|
||||
go func() {
|
||||
defer shutdownContainer() // also close if we get an agent shutdown / idle timeout
|
||||
|
||||
@@ -849,7 +842,6 @@ func (a *agent) runHot(ctx context.Context, call *call, tok ResourceToken, state
|
||||
|
||||
slot := &hotSlot{
|
||||
done: make(chan struct{}),
|
||||
errC: errC,
|
||||
container: container,
|
||||
cfg: &a.cfg,
|
||||
udsClient: udsClient,
|
||||
@@ -870,17 +862,6 @@ func (a *agent) runHot(ctx context.Context, call *call, tok ResourceToken, state
|
||||
}()
|
||||
|
||||
res := waiter.Wait(ctx)
|
||||
if err := res.Error(); err != nil {
|
||||
if err == context.Canceled {
|
||||
// TODO consider removal after format biz mellows out (t-minus 30 days)
|
||||
// we can turn this into a user visible error (for now) if the container
|
||||
// exits because they are using the wrong format, say, and try to guess/
|
||||
// help them out for now. context.Canceled only comes from container exit.
|
||||
errC <- models.ErrContainerExitedEarly
|
||||
} else {
|
||||
errC <- err // TODO: race condition, no guaranteed delivery fix this... we can't really, if nobody is there it's working as intended for idle timeout?
|
||||
}
|
||||
}
|
||||
if res.Error() != context.Canceled {
|
||||
logger.WithError(res.Error()).Info("hot function terminated")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user