Skip to content
This repository has been archived by the owner on Aug 12, 2022. It is now read-only.

Add Warning About File Descriptor Usage #126

Merged
merged 9 commits into from
Dec 13, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"embed"
"errors"
"fmt"
"strings"
"sync"
"sync/atomic"

Expand Down Expand Up @@ -259,6 +260,11 @@ func (p *Provider) collectExecutionDiagnostics(client schema.ClientMeta, exec sc
diagnostics = append(diagnostics, dd...)
continue
}

if strings.Contains(e.Error(), ": socket: too many open files") {
diagnostics = append(diagnostics, diag.FromError(e.Err, diag.WARNING, diag.THROTTLE, exec.ResourceName, e.Error(), "try increasing number of available file descriptors via `ulimit -n 10240` or by increasing timeout via provider specific parameters"))
continue
}
// if error wasn't classified by provider mark it as error
diagnostics = append(diagnostics, diag.FromError(e.Err, diag.ERROR, diag.RESOLVING, exec.ResourceName, e.Error(), ""))
}
Expand Down
21 changes: 16 additions & 5 deletions provider/schema/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"reflect"
"runtime/debug"
"strings"
"sync/atomic"
"time"

Expand Down Expand Up @@ -195,11 +196,21 @@ func (e ExecutionData) callTableResolve(ctx context.Context, client ClientMeta,
close(res)
}()
err := e.Table.Resolver(ctx, client, parent, res)
if err != nil && e.Table.IgnoreError != nil && e.Table.IgnoreError(err) {
client.Logger().Warn("ignored an error", "err", err, "table", e.Table.Name)
// add partial fetch error, this will be passed in diagnostics, although it was ignored
_ = e.checkPartialFetchError(err, parent, "table resolver ignored error")
return
if err != nil {
if e.Table.IgnoreError != nil && e.Table.IgnoreError(err) {
client.Logger().Warn("ignored an error", "err", err, "table", e.Table.Name)
// add partial fetch error, this will be passed in diagnostics, although it was ignored
_ = e.checkPartialFetchError(err, parent, "table resolver ignored error")
return
}

// Not sure if this should be before we check for an IgnoredError as it is a unique error that we know about locally
if strings.Contains(err.Error(), ": socket: too many open files") {
client.Logger().Warn("try increasing number of available file descriptors via `ulimit -n 10240` or by increasing timeout via provider specific parameters")
_ = e.checkPartialFetchError(err, parent, "table resolver ignored error")
return

}
bbernays marked this conversation as resolved.
Show resolved Hide resolved
}
resolverErr = err
}()
Expand Down