#✋ I'm stuck on a mysterious long-running

1 messages · Page 1 of 1 (latest)

proven quest
#

My local version of that source() function:

// Return the Dagger source code, after applying codegen
func (dev *DaggerDev) Source() *Directory {
    modules := []string{
        //        "dev",
        "dev/dirdiff",
        //        "dev/go",
        //        "dev/graphql",
        //        "dev/shellcheck",
        //        "dev/markdown",
        //        "sdk/go",
        //        "sdk/python",
    }
    eg, ctx := errgroup.WithContext(context.Background())
    layers := make(chan *Directory, len(modules))
    for _, module := range modules {
        module := module
        ctx, span := Tracer().Start(ctx, "spawn codegen "+module)
        eg.Go(func() error {
            _, span := Tracer().Start(ctx, "codegen "+module)
            defer span.End()
            layers <- dev.Src.
                AsModule(dagger.DirectoryAsModuleOpts{
                    SourceRootPath: module,
                }).
                GeneratedContextDirectory()
            return nil
        })
        span.End()
    }
    src := dev.Src
    for layer := range layers {
        src = src.WithDirectory("/", layer)
    }
    close(layers)
    return src
}
#

I'm modifying it to be parallelized, hence the errgrouops

#

the commented out entries are debugging, doesn't make a difference

#

the extra spans also

#

note that none of my spans ever appear in the trace. It's just exec /runtime which is weird,right?

#

Is it something stupid like a deadlock in my goroutines? But then I would at least see the "spawn codegen XXX" spans?

#

Definitely looks like a deadlock

#

But confusing that the spans never show?

wraith sinew
#

Maybe I'm missing it, don't you need a eg.Wait()?

proven quest
#

Yeah that was it

#

Now the remaining mystery is, why did the spans never show up in telemetry, sending me on the wrong path

#

I think it's because I need to pass a context received from the SDK

#

(my wild guess - @steel finch does that feel right?)

#

eg. would this not show up in TUI or Traces: Tracer().Start(context.Background(), "I am invisible :(")

steel finch
proven quest
#

Mystery solved... Thanks!