You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
loggingexporter: Error: failed to shutdown service: failed to shutdown pipelines: failed to shutdown exporters: sync /dev/stderr: bad file descriptor
#4153
Closed
pmalek-sumo opened this issue
Sep 30, 2021
· 3 comments
· Fixed by #5585
When trying to run collector using the following piece of code:
import (
"net""testing""time""github.com/stretchr/testify/require""go.opentelemetry.io/collector/component""go.opentelemetry.io/collector/service"
)
funcTestConfig(t*testing.T) {
// components() generated with opentelemetry builderfactories, err:=components()
require.NoError(t, err)
t.Log("Creating new app...")
app, err:=service.New(service.CollectorSettings{
BuildInfo: component.DefaultBuildInfo(),
Factories: factories,
})
require.NoError(t, err)
app.Command().Root().SetArgs(
[]string{
"--config=testdata/filelog.yaml",
"--metrics-addr="+GetAvailableLocalAddress(t),
"--log-level=debug",
},
)
gofunc() {
<-time.NewTimer(3*time.Second).Ct.Log("Calling .Shutdown() on the app...")
app.Shutdown()
}()
t.Log("Calling .Run() on the app...")
require.NoError(t, app.Run())
}
one can observe the following error:
2021-09-30T17:11:41.596+0200 info service/service.go:152 Stopping extensions...
2021-09-30T17:11:41.596+0200 info service/collector.go:353 Shutdown complete.
Error: failed to shutdown service: failed to shutdown pipelines: failed to shutdown exporters: sync /dev/stderr: bad file descriptor
Steps to reproduce
Use the above piece of code
What did you expect to see?
No error.
What did you see instead?
bad file descriptor error
What version did you use?
Version: 2116719 vel v0.35.0
Environment
OS: mac
Compiler(if manually compiled): "go 1.17.1"
Additional context
When debugging the above mentioned piece of code with e.g. delve I do not get the error because the underlying error is unix.ENOTTY which is in the set of known sync errors
(dlv) n
> go.opentelemetry.io/collector/exporter/loggingexporter.loggerSync.func1() /Users/pmalek/.gvm/pkgsets/go1.17.1/global/pkg/mod/go.opentelemetry.io/[email protected]/exporter/loggingexporter/logging_exporter.go:154 (PC: 0x49f37d1)
149: // Since these are not actionable ignore them.
150: err := logger.Sync()
151: if osErr, ok := err.(*os.PathError); ok {
152: wrappedErr := osErr.Unwrap()
153: if knownSyncError(wrappedErr) {
=> 154: err = nil
155: }
156: }
157: return err
158: }
159: }
(dlv) p osErr
*io/fs.PathError {
Op: "sync",
Path: "/dev/stderr",
Err: error(syscall.Errno) golang.org/x/sys/unix.ENOTTY (25),}
My proposal for this issue is to add syscall.EBADF to knownSyncError() (unless there's someone to point out a better way to approach this).
The text was updated successfully, but these errors were encountered:
I can reproduce this on macOS on the Datadog Agent (which uses the logging exporter). Opened #5585 to fix this with the approach proposed by @pmalek-sumo, since I haven't been able to find a better solution. Note that the correct error code seems to be syscall.EBADF ("Bad file descriptor") instead of syscall.EBADFD ("File descriptor in bad state"). See here for details.
Describe the bug
When trying to run collector using the following piece of code:
one can observe the following error:
Steps to reproduce
Use the above piece of code
What did you expect to see?
No error.
What did you see instead?
bad file descriptor error
What version did you use?
Version: 2116719 vel
v0.35.0
What config did you use?
The test load the following config:
Environment
OS: mac
Compiler(if manually compiled): "go 1.17.1"
Additional context
When debugging the above mentioned piece of code with e.g. delve I do not get the error because the underlying error is
unix.ENOTTY
which is in the set of known sync errorsMy proposal for this issue is to add
syscall.EBADF
toknownSyncError()
(unless there's someone to point out a better way to approach this).The text was updated successfully, but these errors were encountered: