status
stringclasses
1 value
repo_name
stringclasses
31 values
repo_url
stringclasses
31 values
issue_id
int64
1
104k
title
stringlengths
4
233
body
stringlengths
0
186k
βŒ€
issue_url
stringlengths
38
56
pull_url
stringlengths
37
54
before_fix_sha
stringlengths
40
40
after_fix_sha
stringlengths
40
40
report_datetime
unknown
language
stringclasses
5 values
commit_datetime
unknown
updated_file
stringlengths
7
188
chunk_content
stringlengths
1
1.03M
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) _, err := goGitBase(t, c). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). With(daggerExec("init", "--name=depA", "--sdk=go", "depA")). With(daggerExec("init", "--name=depB", "--sdk=go", "depB")). With(daggerExec("init", "--name=depC", "--sdk=go", "depC")). With(daggerExec("install", "-m=depC", "./depB")). With(daggerExec("install", "-m=depB", "./depA")). With(daggerExec("install", "-m=depA", "./depC")). Sync(ctx) require.ErrorContains(t, err, `local module at "/work/depA" has a circular dependency`) } var badIDArgGoSrc string var badIDArgPySrc string var badIDArgTSSrc string var badIDFieldGoSrc string var badIDFieldTSSrc string var badIDFnGoSrc string var badIDFnPySrc string var badIDFnTSSrc string func TestModuleReservedWords(t *testing.T) { t.Parallel() type testCase struct { sdk string source string }
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/module_test.go
t.Run("id", func(t *testing.T) { t.Parallel() t.Run("arg", func(t *testing.T) { t.Parallel() for _, tc := range []testCase{ { sdk: "go", source: badIDArgGoSrc, }, { sdk: "python", source: badIDArgPySrc, }, { sdk: "typescript", source: badIDArgTSSrc, }, } { tc := tc t.Run(tc.sdk, func(t *testing.T) { t.Parallel() c, ctx := connect(t) _, err := modInit(ctx, t, c, tc.sdk, tc.source). With(daggerQuery(`{test{fn(id:"no")}}`)). Sync(ctx) require.ErrorContains(t, err, "cannot define argument with reserved name \"id\"") }) } }) t.Run("field", func(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/module_test.go
t.Parallel() for _, tc := range []testCase{ { sdk: "go", source: badIDFieldGoSrc, }, { sdk: "typescript", source: badIDFieldTSSrc, }, } { tc := tc t.Run(tc.sdk, func(t *testing.T) { t.Parallel() c, ctx := connect(t) _, err := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("init", "--name=test", "--sdk="+tc.sdk)). With(sdkSource(tc.sdk, tc.source)). With(daggerQuery(`{test{fn{id}}}`)). Sync(ctx) require.ErrorContains(t, err, "cannot define field with reserved name \"id\"") }) } }) t.Run("fn", func(t *testing.T) { t.Parallel() for _, tc := range []testCase{ {
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/module_test.go
sdk: "go", source: badIDFnGoSrc, }, { sdk: "python", source: badIDFnPySrc, }, { sdk: "typescript", source: badIDFnTSSrc, }, } { tc := tc t.Run(tc.sdk, func(t *testing.T) { t.Parallel() c, ctx := connect(t) _, err := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("init", "--name=test", "--sdk="+tc.sdk)). With(sdkSource(tc.sdk, tc.source)). With(daggerQuery(`{test{id}}`)). Sync(ctx) require.ErrorContains(t, err, "cannot define function with reserved name \"id\"") }) } }) }) } func TestModuleExecError(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) modGen := c.Container().From(alpineImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("init", "--source=.", "--name=playground", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: ` package main import ( "context" "errors" ) type Playground struct{} func (p *Playground) DoThing(ctx context.Context) error { _, err := dag.Container().From("` + alpineImage + `").WithExec([]string{"sh", "-c", "exit 5"}).Sync(ctx) var e *ExecError if errors.As(err, &e) { if e.ExitCode == 5 { return nil } } panic("yikes") } `}) _, err := modGen. With(daggerQuery(`{playground{doThing}}`)). Stdout(ctx) require.NoError(t, err)
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/module_test.go
} func TestModuleCurrentModuleAPI(t *testing.T) { t.Parallel() t.Run("name", func(t *testing.T) { t.Parallel() c, ctx := connect(t) out, err := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("init", "--source=.", "--name=WaCkY", "--sdk=go")). WithNewFile("/work/main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main import "context" type WaCkY struct {} func (m *WaCkY) Fn(ctx context.Context) (string, error) { return dag.CurrentModule().Name(ctx) } `, }). With(daggerCall("fn")). Stdout(ctx) require.NoError(t, err) require.Equal(t, "WaCkY", strings.TrimSpace(out)) }) t.Run("source", func(t *testing.T) { t.Parallel() c, ctx := connect(t) out, err := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work").
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/module_test.go
With(daggerExec("init", "--source=.", "--name=test", "--sdk=go")). WithNewFile("/work/subdir/coolfile.txt", dagger.ContainerWithNewFileOpts{ Contents: "nice", }). WithNewFile("/work/main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main import "context" type Test struct {} func (m *Test) Fn(ctx context.Context) *File { return dag.CurrentModule().Source().File("subdir/coolfile.txt") } `, }). With(daggerCall("fn", "contents")). Stdout(ctx) require.NoError(t, err) require.Equal(t, "nice", strings.TrimSpace(out)) }) t.Run("workdir", func(t *testing.T) { t.Parallel() t.Run("dir", func(t *testing.T) { t.Parallel() c, ctx := connect(t) out, err := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("init", "--source=.", "--name=test", "--sdk=go")). WithNewFile("/work/main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main import (
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/module_test.go
"context" "os" ) type Test struct {} func (m *Test) Fn(ctx context.Context) (*Directory, error) { if err := os.MkdirAll("subdir/moresubdir", 0755); err != nil { return nil, err } if err := os.WriteFile("subdir/moresubdir/coolfile.txt", []byte("nice"), 0644); err != nil { return nil, err } return dag.CurrentModule().Workdir("subdir/moresubdir"), nil } `, }). With(daggerCall("fn", "file", "--path=coolfile.txt", "contents")). Stdout(ctx) require.NoError(t, err) require.Equal(t, "nice", strings.TrimSpace(out)) }) t.Run("file", func(t *testing.T) { t.Parallel() c, ctx := connect(t) out, err := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("init", "--source=.", "--name=test", "--sdk=go")). WithNewFile("/work/main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main import (
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/module_test.go
"context" "os" ) type Test struct {} func (m *Test) Fn(ctx context.Context) (*File, error) { if err := os.MkdirAll("subdir/moresubdir", 0755); err != nil { return nil, err } if err := os.WriteFile("subdir/moresubdir/coolfile.txt", []byte("nice"), 0644); err != nil { return nil, err } return dag.CurrentModule().WorkdirFile("subdir/moresubdir/coolfile.txt"), nil } `, }). With(daggerCall("fn", "contents")). Stdout(ctx) require.NoError(t, err) require.Equal(t, "nice", strings.TrimSpace(out)) }) t.Run("error on escape", func(t *testing.T) { t.Parallel() c, ctx := connect(t) ctr := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("init", "--source=.", "--name=test", "--sdk=go")). WithNewFile("/work/main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main import (
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/module_test.go
"context" "os" ) func New() (*Test, error) { if err := os.WriteFile("/rootfile.txt", []byte("notnice"), 0644); err != nil { return nil, err } if err := os.MkdirAll("/foo", 0755); err != nil { return nil, err } if err := os.WriteFile("/foo/foofile.txt", []byte("notnice"), 0644); err != nil { return nil, err } return &Test{}, nil } type Test struct {} func (m *Test) EscapeFile(ctx context.Context) *File { return dag.CurrentModule().WorkdirFile("../rootfile.txt") } func (m *Test) EscapeFileAbs(ctx context.Context) *File { return dag.CurrentModule().WorkdirFile("/rootfile.txt") } func (m *Test) EscapeDir(ctx context.Context) *Directory { return dag.CurrentModule().Workdir("../foo") } func (m *Test) EscapeDirAbs(ctx context.Context) *Directory { return dag.CurrentModule().Workdir("/foo") } `, })
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/module_test.go
_, err := ctr. With(daggerCall("escape-file", "contents")). Stdout(ctx) require.ErrorContains(t, err, `workdir path "../rootfile.txt" escapes workdir`) _, err = ctr. With(daggerCall("escape-file-abs", "contents")). Stdout(ctx) require.ErrorContains(t, err, `workdir path "/rootfile.txt" escapes workdir`) _, err = ctr. With(daggerCall("escape-dir", "entries")). Stdout(ctx) require.ErrorContains(t, err, `workdir path "../foo" escapes workdir`) _, err = ctr. With(daggerCall("escape-dir-abs", "entries")). Stdout(ctx) require.ErrorContains(t, err, `workdir path "/foo" escapes workdir`) }) }) } func TestModuleCustomSDK(t *testing.T) { t.Parallel() t.Run("local", func(t *testing.T) { t.Parallel() c, ctx := connect(t) ctr := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work/coolsdk"). With(daggerExec("init", "--source=.", "--name=cool-sdk", "--sdk=go")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/module_test.go
type CoolSdk struct {} func (m *CoolSdk) ModuleRuntime(modSource *ModuleSource, introspectionJson string) *Container { return modSource.WithSDK("go").AsModule().Runtime().WithEnvVariable("COOL", "true") } func (m *CoolSdk) Codegen(modSource *ModuleSource, introspectionJson string) *GeneratedCode { return dag.GeneratedCode(modSource.WithSDK("go").AsModule().GeneratedContextDirectory()) } func (m *CoolSdk) RequiredPaths() []string { return []string{ "**/go.mod", "**/go.sum", "**/go.work", "**/go.work.sum", "**/vendor/", "**/*.go", } } `, }). WithWorkdir("/work"). With(daggerExec("init", "--source=.", "--name=test", "--sdk=coolsdk")). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main import "os" type Test struct {} func (m *Test) Fn() string { return os.Getenv("COOL") } `, })
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/module_test.go
out, err := ctr. With(daggerCall("fn")). Stdout(ctx) require.NoError(t, err) require.Equal(t, "true", strings.TrimSpace(out)) }) t.Run("git", func(t *testing.T) { t.Parallel() c, ctx := connect(t) ctr := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("init", "--source=.", "--name=test", "--sdk="+testGitModuleRef("cool-sdk"))). WithNewFile("main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main import "os" type Test struct {} func (m *Test) Fn() string { return os.Getenv("COOL") } `, }) out, err := ctr. With(daggerCall("fn")). Stdout(ctx) require.NoError(t, err) require.Equal(t, "true", strings.TrimSpace(out)) }) } func TestModuleHostError(t *testing.T) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/module_test.go
t.Parallel() c, ctx := connect(t) _, err := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("init", "--source=.", "--name=test", "--sdk=go")). WithNewFile("/work/main.go", dagger.ContainerWithNewFileOpts{ Contents: `package main import ( "context" ) type Test struct {} func (m *Test) Fn(ctx context.Context) *Directory { return dag.Host().Directory(".") } `, }). With(daggerCall("fn")). Sync(ctx) require.ErrorContains(t, err, "dag.Host undefined") } func daggerExec(args ...string) dagger.WithContainerFunc {
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/module_test.go
return func(c *dagger.Container) *dagger.Container { return c.WithExec(append([]string{"dagger", "--debug"}, args...), dagger.ContainerWithExecOpts{ ExperimentalPrivilegedNesting: true, }) } } func daggerQuery(query string, args ...any) dagger.WithContainerFunc { return daggerQueryAt("", query, args...) } func daggerQueryAt(modPath string, query string, args ...any) dagger.WithContainerFunc { query = fmt.Sprintf(query, args...) return func(c *dagger.Container) *dagger.Container { execArgs := []string{"dagger", "--debug", "query"} if modPath != "" { execArgs = append(execArgs, "-m", modPath) } return c.WithExec(execArgs, dagger.ContainerWithExecOpts{ Stdin: query, ExperimentalPrivilegedNesting: true, }) } } func daggerCall(args ...string) dagger.WithContainerFunc { return daggerCallAt("", args...) } func daggerCallAt(modPath string, args ...string) dagger.WithContainerFunc {
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/module_test.go
return func(c *dagger.Container) *dagger.Container { execArgs := []string{"dagger", "--debug", "call"} if modPath != "" { execArgs = append(execArgs, "-m", modPath) } return c.WithExec(append(execArgs, args...), dagger.ContainerWithExecOpts{ ExperimentalPrivilegedNesting: true, }) } } func daggerFunctions(args ...string) dagger.WithContainerFunc { return func(c *dagger.Container) *dagger.Container { return c.WithExec(append([]string{"dagger", "--debug", "functions"}, args...), dagger.ContainerWithExecOpts{ ExperimentalPrivilegedNesting: true, }) } } func configFile(dirPath string, cfg *modules.ModuleConfig) dagger.WithContainerFunc { return func(c *dagger.Container) *dagger.Container { cfgPath := filepath.Join(dirPath, "dagger.json") cfgBytes, err := json.Marshal(cfg) if err != nil { panic(err) } return c.WithNewFile(cfgPath, dagger.ContainerWithNewFileOpts{ Contents: string(cfgBytes), }) } } func hostDaggerCommand(ctx context.Context, t testing.TB, workdir string, args ...string) *exec.Cmd {
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/module_test.go
t.Helper() cmd := exec.CommandContext(ctx, daggerCliPath(t), args...) cmd.Dir = workdir return cmd } func hostDaggerExec(ctx context.Context, t testing.TB, workdir string, args ...string) ([]byte, error) { t.Helper() cmd := hostDaggerCommand(ctx, t, workdir, args...) output, err := cmd.CombinedOutput() if err != nil { err = fmt.Errorf("%s: %w", string(output), err) } return output, err } func sdkSource(sdk, contents string) dagger.WithContainerFunc { return func(c *dagger.Container) *dagger.Container { sourcePath := sdkSourceFile(sdk) if sourcePath == "" { return c } return c.WithNewFile(sourcePath, dagger.ContainerWithNewFileOpts{ Contents: heredoc.Doc(contents), }) } } func sdkSourceFile(sdk string) string {
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/module_test.go
switch sdk { case "go": return "dagger/main.go" case "python": return "dagger/src/main.py" case "typescript": return "dagger/src/index.ts" default: return "" } } func sdkCodegenFile(t *testing.T, sdk string) string { t.Helper() switch sdk { case "go": return "dagger/internal/dagger/dagger.gen.go" case "python": return "dagger/sdk/src/dagger/client/gen.py" case "typescript": return "dagger/sdk/api/client.gen.ts" default: return "" } } func modInit(ctx context.Context, t *testing.T, c *dagger.Client, sdk, contents string) *dagger.Container {
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/module_test.go
t.Helper() modGen := c.Container().From(golangImage). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). With(daggerExec("init", "--name=test", "--sdk="+sdk)). With(sdkSource(sdk, contents)) return modGen } func currentSchema(ctx context.Context, t *testing.T, ctr *dagger.Container) *introspection.Schema { t.Helper() out, err := ctr.With(daggerQuery(introspection.Query)).Stdout(ctx) require.NoError(t, err) var schemaResp introspection.Response err = json.Unmarshal([]byte(out), &schemaResp) require.NoError(t, err) return schemaResp.Schema } var moduleIntrospection = daggerQuery(` query { host { directory(path: ".") { asModule { initialize { description
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/module_test.go
objects { asObject { name description constructor { description args { name description defaultValue } } functions { name description args { name description defaultValue } } fields { name description } } } } } } } } `) func inspectModule(ctx context.Context, t *testing.T, ctr *dagger.Container) gjson.Result {
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/module_test.go
t.Helper() out, err := ctr.With(moduleIntrospection).Stdout(ctx) require.NoError(t, err) result := gjson.Get(out, "host.directory.asModule.initialize") t.Logf("module introspection:\n%v", result.Raw) return result } func inspectModuleObjects(ctx context.Context, t *testing.T, ctr *dagger.Container) gjson.Result { t.Helper() return inspectModule(ctx, t, ctr).Get("objects.#.asObject") } func goGitBase(t *testing.T, c *dagger.Client) *dagger.Container { t.Helper() return c.Container().From(golangImage). WithExec([]string{"apk", "add", "git"}). WithExec([]string{"git", "config", "--global", "user.email", "[email protected]"}). WithExec([]string{"git", "config", "--global", "user.name", "Dagger Tests"}). WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). WithWorkdir("/work"). WithExec([]string{"git", "init"}) } func logGen(ctx context.Context, t *testing.T, modSrc *dagger.Directory) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/module_test.go
t.Helper() generated, err := modSrc.File("dagger.gen.go").Contents(ctx) require.NoError(t, err) t.Cleanup(func() { t.Name() fileName := filepath.Join( os.TempDir(), t.Name(), fmt.Sprintf("dagger.gen.%d.go", time.Now().Unix()), ) if err := os.MkdirAll(filepath.Dir(fileName), 0o755); err != nil { t.Logf("failed to create temp dir for generated code: %v", err) return } if err := os.WriteFile(fileName, []byte(generated), 0644); err != nil { t.Logf("failed to write generated code to %s: %v", fileName, err) } else { t.Logf("wrote generated code to %s", fileName) } }) }
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/suite_test.go
package core import ( "archive/tar" "bytes" "context" "crypto/md5" "errors" "fmt" "io" "os" "os/exec" "strings" "sync" "testing" "dagger.io/dagger" "github.com/dagger/dagger/core" "github.com/dagger/dagger/internal/testutil" "github.com/moby/buildkit/identity" "github.com/stretchr/testify/require" ) func connect(t testing.TB, opts ...dagger.ClientOpt) (*dagger.Client, context.Context) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/suite_test.go
ctx, cancel := context.WithCancel(context.Background()) t.Cleanup(cancel) opts = append([]dagger.ClientOpt{ dagger.WithLogOutput(newTWriter(t)), }, opts...) client, err := dagger.Connect(ctx, opts...) require.NoError(t, err) t.Cleanup(func() { client.Close() }) return client, ctx } func newCache(t testing.TB) core.CacheVolumeID { var res struct { CacheVolume struct { ID core.CacheVolumeID } } err := testutil.Query(` query CreateCache($key: String!) { cacheVolume(key: $key) { id } } `, &res, &testutil.QueryOptions{Variables: map[string]any{ "key": identity.NewID(), }}) require.NoError(t, err) return res.CacheVolume.ID } func newDirWithFile(t testing.TB, path, contents string) core.DirectoryID { dirRes := struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/suite_test.go
Directory struct { WithNewFile struct { ID core.DirectoryID } } }{} err := testutil.Query( `query Test($path: String!, $contents: String!) { directory { withNewFile(path: $path, contents: $contents) { id } } }`, &dirRes, &testutil.QueryOptions{Variables: map[string]any{ "path": path, "contents": contents, }}) require.NoError(t, err) return dirRes.Directory.WithNewFile.ID } func newFile(t testing.TB, path, contents string) core.FileID { var secretRes struct { Directory struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/suite_test.go
WithNewFile struct { File struct { ID core.FileID } } } } err := testutil.Query( `query Test($path: String!, $contents: String!) { directory { withNewFile(path: $path, contents: $contents) { file(path: "some-file") { id } } } }`, &secretRes, &testutil.QueryOptions{Variables: map[string]any{ "path": path, "contents": contents, }}) require.NoError(t, err) fileID := secretRes.Directory.WithNewFile.File.ID require.NotEmpty(t, fileID) return fileID } const ( registryHost = "registry:5000" privateRegistryHost = "privateregistry:5000" ) func registryRef(name string) string {
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/suite_test.go
return fmt.Sprintf("%s/%s:%s", registryHost, name, identity.NewID()) } func privateRegistryRef(name string) string { return fmt.Sprintf("%s/%s:%s", privateRegistryHost, name, identity.NewID()) } func ls(dir string) ([]string, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/suite_test.go
ents, err := os.ReadDir(dir) if err != nil { return nil, err } names := make([]string, len(ents)) for i, ent := range ents { names[i] = ent.Name() } return names, nil } func tarEntries(t testing.TB, path string) []string { f, err := os.Open(path) require.NoError(t, err) entries := []string{} tr := tar.NewReader(f) for { hdr, err := tr.Next() if err != nil { if errors.Is(err, io.EOF) { break } require.NoError(t, err) } entries = append(entries, hdr.Name) } return entries } func readTarFile(t testing.TB, pathToTar, pathInTar string) []byte {
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/suite_test.go
f, err := os.Open(pathToTar) require.NoError(t, err) tr := tar.NewReader(f) for { hdr, err := tr.Next() if err != nil { if errors.Is(err, io.EOF) { break } require.NoError(t, err) } if hdr.Name == pathInTar { b, err := io.ReadAll(tr) require.NoError(t, err) return b } } return nil } func computeMD5FromReader(reader io.Reader) string { h := md5.New() io.Copy(h, reader) return fmt.Sprintf("%x", h.Sum(nil)) } func daggerCliPath(t testing.TB) string {
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/suite_test.go
t.Helper() cliPath := os.Getenv("_EXPERIMENTAL_DAGGER_CLI_BIN") if cliPath == "" { var err error cliPath, err = exec.LookPath("dagger") require.NoError(t, err) } if cliPath == "" { t.Log("missing _EXPERIMENTAL_DAGGER_CLI_BIN") t.FailNow() } return cliPath } func daggerCliFile(t testing.TB, c *dagger.Client) *dagger.File { t.Helper() return c.Host().File(daggerCliPath(t)) } const testCLIBinPath = "/bin/dagger" func goCache(c *dagger.Client) dagger.WithContainerFunc { return func(ctr *dagger.Container) *dagger.Container { return ctr. WithMountedCache("/go/pkg/mod", c.CacheVolume("go-mod")). WithEnvVariable("GOMODCACHE", "/go/pkg/mod"). WithMountedCache("/go/build-cache", c.CacheVolume("go-build")). WithEnvVariable("GOCACHE", "/go/build-cache") } } type tWriter struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/suite_test.go
t testing.TB buf bytes.Buffer mu sync.Mutex } func newTWriter(t testing.TB) *tWriter { tw := &tWriter{t: t} t.Cleanup(tw.flush) return tw } func (tw *tWriter) Write(p []byte) (n int, err error) { tw.mu.Lock() defer tw.mu.Unlock() tw.t.Helper() if n, err = tw.buf.Write(p); err != nil { return n, err } for { line, err := tw.buf.ReadBytes('\n') if err == io.EOF {
closed
dagger/dagger
https://github.com/dagger/dagger
6,640
🐞 CLI: dagger listen --disable-host-read-write fails in v0.9.9
### What is the issue? There is a regression on dagger v0.9.9 with the dagger listen command when the flag `--disable-host-read-write` is specified. Prior to v0.9.8 this was working correctly. Since v0.9.9 it fails with: ``` Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ``` If you run this command inside a module it also fails with the same error: ``` $ dagger mod init --name test --sdk go $ dagger listen --disable-host-read-write β”œ [0.01s] loading module ✘ directory ERROR [0.01s] β–Ά directory β–Ά host.directory /home/matipan/bin/test ✘ upload /home/matipan/bin/test from pop-os (client id: 09oib86lak5rdy6j1tbxf2gbu) ERROR [0.01s] β”œ [0.00s] transferring /home/matipan/bin/test: β€’ Engine: 6241366fb45d (version v0.9.7) β§— 1.97s βœ” 6 ✘ 3 Error: failed to get loaded module ID: input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled input: resolve: host: directory: host directory /home/matipan/bin/test: no local sources enabled ``` ### Dagger version dagger v0.9.9 ([registry.dagger.io/engine](http://registry.dagger.io/engine)) linux/amd64 ### Steps to reproduce ``` $ dagger listen --progress plain --disable-host-read-write ``` ### Log output ``` Connected to engine 5c478db0e017 (version v0.9.9) Error: failed to get configured module: failed to get local root path: input: resolve: moduleSource: resolveContextPathFromCaller: failed to stat source root: failed to receive file bytes message: rpc error: code = Unimplemented desc = unknown service moby.filesync.v1.FileSync ```
https://github.com/dagger/dagger/issues/6640
https://github.com/dagger/dagger/pull/6732
b966257dbc24b714e6ee39f01158f10f8fa24fd3
ca447cd4d7ca6d25e62008d3e1f87100111709df
"2024-02-09T14:29:11Z"
go
"2024-02-26T17:12:49Z"
core/integration/suite_test.go
tw.buf.Write(line) break } if err != nil { return n, err } tw.t.Log(strings.TrimSuffix(string(line), "\n")) } return n, nil } func (tw *tWriter) flush() { tw.mu.Lock() defer tw.mu.Unlock() tw.t.Log(tw.buf.String()) } type safeBuffer struct { bu bytes.Buffer mu sync.Mutex } func (s *safeBuffer) Write(p []byte) (n int, err error) { s.mu.Lock() defer s.mu.Unlock() return s.bu.Write(p) } func (s *safeBuffer) String() string { s.mu.Lock() defer s.mu.Unlock() return s.bu.String() }
closed
dagger/dagger
https://github.com/dagger/dagger
6,728
Zenith: default to use a class instead of top-level functions in Python
## Summary Change the `dagger init` template for Python to use a class instead of just functions. Also update documentation snippets to do the same. ## Motivation In an earlier iteration of Dagger modules, when the concept of objects that contain functions were introduced, the Python SDK kept the convenience of being able to define simple top-level functions, without having to convert into a class. Python allows this by transparently β€œcreating” the object and associate the top-level functions with it, behind the scenes. It provides a nicer experience for simple use cases, where users don’t have to get the name right for the class, since it has to match the module name. However, you can’t add a description to the main object this way. And over time we’ve added state to object types, and constructors to initialize that state. Using state has become a common pattern, so a user may **quite often need to convert the top-level functions into a class**. That takes me back to a few years ago, working with React. You used to be able to create components using either a function or a class. Most people prefer the simplicity of functions, but in React, if you reached a point where you needed to access some lifecycle hooks, you’d need to convert the function into a class. I had to do that a lot myself. I remember the frustration in the community around this, growing as adoption increased[^1]. I’ve found myself doing this in Python a few times too, and I’ve grown concerned that it’ll add some of the same confusion, frustration or just friction for our users. For this reason, I think we should default to talk about Python SDK modules using the class, instead of top-level functions, in the documentation and examples. It also makes it more consistent with Go and TypeScript. [^1]: They eventually fixed it by making classes obsolete and have full-featured hooks in functions. ## Deprecation I have no plans, nor do I suggest, to deprecate top-level functions at this point. They’ll still be available, just more hidden. We’ll revisit at a later time. \cc @vikram-dagger @jpadams
https://github.com/dagger/dagger/issues/6728
https://github.com/dagger/dagger/pull/6729
e64f185334734a37a2f18a95ec3cf21a27e32437
4b7ab1e217d1f2da30723905282ba3cf27de8cab
"2024-02-24T00:58:03Z"
go
"2024-02-26T19:06:17Z"
internal/mage/util/engine.go
package util import ( "bytes" "context" "encoding/json" "fmt" "path/filepath" "runtime" "sort" "strings" "text/template" "time" "dagger.io/dagger" "github.com/moby/buildkit/identity" ocispecs "github.com/opencontainers/image-spec/specs-go/v1" "golang.org/x/exp/maps" "github.com/dagger/dagger/internal/distconsts" ) const ( engineServerPath = "/usr/local/bin/dagger-engine" engineDialStdioPath = "/usr/local/bin/dial-stdio" engineShimPath = distconsts.EngineShimPath golangVersion = "1.21.7" alpineVersion = "3.18" ubuntuVersion = "22.04" runcVersion = "v1.1.12" cniVersion = "v1.3.0" qemuBinImage = "tonistiigi/binfmt@sha256:e06789462ac7e2e096b53bfd9e607412426850227afeb1d0f5dfa48a731e0ba5"
closed
dagger/dagger
https://github.com/dagger/dagger
6,728
Zenith: default to use a class instead of top-level functions in Python
## Summary Change the `dagger init` template for Python to use a class instead of just functions. Also update documentation snippets to do the same. ## Motivation In an earlier iteration of Dagger modules, when the concept of objects that contain functions were introduced, the Python SDK kept the convenience of being able to define simple top-level functions, without having to convert into a class. Python allows this by transparently β€œcreating” the object and associate the top-level functions with it, behind the scenes. It provides a nicer experience for simple use cases, where users don’t have to get the name right for the class, since it has to match the module name. However, you can’t add a description to the main object this way. And over time we’ve added state to object types, and constructors to initialize that state. Using state has become a common pattern, so a user may **quite often need to convert the top-level functions into a class**. That takes me back to a few years ago, working with React. You used to be able to create components using either a function or a class. Most people prefer the simplicity of functions, but in React, if you reached a point where you needed to access some lifecycle hooks, you’d need to convert the function into a class. I had to do that a lot myself. I remember the frustration in the community around this, growing as adoption increased[^1]. I’ve found myself doing this in Python a few times too, and I’ve grown concerned that it’ll add some of the same confusion, frustration or just friction for our users. For this reason, I think we should default to talk about Python SDK modules using the class, instead of top-level functions, in the documentation and examples. It also makes it more consistent with Go and TypeScript. [^1]: They eventually fixed it by making classes obsolete and have full-featured hooks in functions. ## Deprecation I have no plans, nor do I suggest, to deprecate top-level functions at this point. They’ll still be available, just more hidden. We’ll revisit at a later time. \cc @vikram-dagger @jpadams
https://github.com/dagger/dagger/issues/6728
https://github.com/dagger/dagger/pull/6729
e64f185334734a37a2f18a95ec3cf21a27e32437
4b7ab1e217d1f2da30723905282ba3cf27de8cab
"2024-02-24T00:58:03Z"
go
"2024-02-26T19:06:17Z"
internal/mage/util/engine.go
engineTomlPath = "/etc/dagger/engine.toml" engineEntrypointPath = "/usr/local/bin/dagger-entrypoint.sh" CacheConfigEnvName = "_EXPERIMENTAL_DAGGER_CACHE_CONFIG" GPUSupportEnvName = "_EXPERIMENTAL_DAGGER_GPU_SUPPORT" ) const engineEntrypointTmpl = `#!/bin/sh set -e # cgroup v2: enable nesting # see https://github.com/moby/moby/blob/38805f20f9bcc5e87869d6c79d432b166e1c88b4/hack/dind#L28 if [ -f /sys/fs/cgroup/cgroup.controllers ]; then # move the processes from the root group to the /init group, # otherwise writing subtree_control fails with EBUSY. # An error during moving non-existent process (i.e., "cat") is ignored. mkdir -p /sys/fs/cgroup/init xargs -rn1 < /sys/fs/cgroup/cgroup.procs > /sys/fs/cgroup/init/cgroup.procs || : # enable controllers sed -e 's/ / +/g' -e 's/^/+/' < /sys/fs/cgroup/cgroup.controllers \ > /sys/fs/cgroup/cgroup.subtree_control fi exec {{.EngineBin}} --config {{.EngineConfig}} {{ range $key := .EntrypointArgKeys -}}--{{ $key }}="{{ index $.EntrypointArgs $key }}" {{ end -}} "$@" ` const engineConfigTmpl = ` debug = true insecure-entitlements = ["security.insecure"] {{ range $key := .ConfigKeys }} [{{ $key }}] {{ index $.ConfigEntries $key }} {{ end -}} ` type DevEngineOpts struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,728
Zenith: default to use a class instead of top-level functions in Python
## Summary Change the `dagger init` template for Python to use a class instead of just functions. Also update documentation snippets to do the same. ## Motivation In an earlier iteration of Dagger modules, when the concept of objects that contain functions were introduced, the Python SDK kept the convenience of being able to define simple top-level functions, without having to convert into a class. Python allows this by transparently β€œcreating” the object and associate the top-level functions with it, behind the scenes. It provides a nicer experience for simple use cases, where users don’t have to get the name right for the class, since it has to match the module name. However, you can’t add a description to the main object this way. And over time we’ve added state to object types, and constructors to initialize that state. Using state has become a common pattern, so a user may **quite often need to convert the top-level functions into a class**. That takes me back to a few years ago, working with React. You used to be able to create components using either a function or a class. Most people prefer the simplicity of functions, but in React, if you reached a point where you needed to access some lifecycle hooks, you’d need to convert the function into a class. I had to do that a lot myself. I remember the frustration in the community around this, growing as adoption increased[^1]. I’ve found myself doing this in Python a few times too, and I’ve grown concerned that it’ll add some of the same confusion, frustration or just friction for our users. For this reason, I think we should default to talk about Python SDK modules using the class, instead of top-level functions, in the documentation and examples. It also makes it more consistent with Go and TypeScript. [^1]: They eventually fixed it by making classes obsolete and have full-featured hooks in functions. ## Deprecation I have no plans, nor do I suggest, to deprecate top-level functions at this point. They’ll still be available, just more hidden. We’ll revisit at a later time. \cc @vikram-dagger @jpadams
https://github.com/dagger/dagger/issues/6728
https://github.com/dagger/dagger/pull/6729
e64f185334734a37a2f18a95ec3cf21a27e32437
4b7ab1e217d1f2da30723905282ba3cf27de8cab
"2024-02-24T00:58:03Z"
go
"2024-02-26T19:06:17Z"
internal/mage/util/engine.go
EntrypointArgs map[string]string ConfigEntries map[string]string Name string } func getEntrypoint(opts ...DevEngineOpts) (string, error) { mergedOpts := map[string]string{} for _, opt := range opts { maps.Copy(mergedOpts, opt.EntrypointArgs) } keys := maps.Keys(mergedOpts) sort.Strings(keys) var entrypoint string type entrypointTmplParams struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,728
Zenith: default to use a class instead of top-level functions in Python
## Summary Change the `dagger init` template for Python to use a class instead of just functions. Also update documentation snippets to do the same. ## Motivation In an earlier iteration of Dagger modules, when the concept of objects that contain functions were introduced, the Python SDK kept the convenience of being able to define simple top-level functions, without having to convert into a class. Python allows this by transparently β€œcreating” the object and associate the top-level functions with it, behind the scenes. It provides a nicer experience for simple use cases, where users don’t have to get the name right for the class, since it has to match the module name. However, you can’t add a description to the main object this way. And over time we’ve added state to object types, and constructors to initialize that state. Using state has become a common pattern, so a user may **quite often need to convert the top-level functions into a class**. That takes me back to a few years ago, working with React. You used to be able to create components using either a function or a class. Most people prefer the simplicity of functions, but in React, if you reached a point where you needed to access some lifecycle hooks, you’d need to convert the function into a class. I had to do that a lot myself. I remember the frustration in the community around this, growing as adoption increased[^1]. I’ve found myself doing this in Python a few times too, and I’ve grown concerned that it’ll add some of the same confusion, frustration or just friction for our users. For this reason, I think we should default to talk about Python SDK modules using the class, instead of top-level functions, in the documentation and examples. It also makes it more consistent with Go and TypeScript. [^1]: They eventually fixed it by making classes obsolete and have full-featured hooks in functions. ## Deprecation I have no plans, nor do I suggest, to deprecate top-level functions at this point. They’ll still be available, just more hidden. We’ll revisit at a later time. \cc @vikram-dagger @jpadams
https://github.com/dagger/dagger/issues/6728
https://github.com/dagger/dagger/pull/6729
e64f185334734a37a2f18a95ec3cf21a27e32437
4b7ab1e217d1f2da30723905282ba3cf27de8cab
"2024-02-24T00:58:03Z"
go
"2024-02-26T19:06:17Z"
internal/mage/util/engine.go
Bridge string EngineBin string EngineConfig string EntrypointArgs map[string]string EntrypointArgKeys []string } tmpl := template.Must(template.New("entrypoint").Parse(engineEntrypointTmpl)) buf := new(bytes.Buffer) err := tmpl.Execute(buf, entrypointTmplParams{ EngineBin: engineServerPath, EngineConfig: engineTomlPath, EntrypointArgs: mergedOpts, EntrypointArgKeys: keys, }) if err != nil { panic(err) } entrypoint = buf.String() return entrypoint, nil } func getConfig(opts ...DevEngineOpts) (string, error) { mergedOpts := map[string]string{} for _, opt := range opts { maps.Copy(mergedOpts, opt.ConfigEntries) } keys := maps.Keys(mergedOpts) sort.Strings(keys) var config string type configTmplParams struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,728
Zenith: default to use a class instead of top-level functions in Python
## Summary Change the `dagger init` template for Python to use a class instead of just functions. Also update documentation snippets to do the same. ## Motivation In an earlier iteration of Dagger modules, when the concept of objects that contain functions were introduced, the Python SDK kept the convenience of being able to define simple top-level functions, without having to convert into a class. Python allows this by transparently β€œcreating” the object and associate the top-level functions with it, behind the scenes. It provides a nicer experience for simple use cases, where users don’t have to get the name right for the class, since it has to match the module name. However, you can’t add a description to the main object this way. And over time we’ve added state to object types, and constructors to initialize that state. Using state has become a common pattern, so a user may **quite often need to convert the top-level functions into a class**. That takes me back to a few years ago, working with React. You used to be able to create components using either a function or a class. Most people prefer the simplicity of functions, but in React, if you reached a point where you needed to access some lifecycle hooks, you’d need to convert the function into a class. I had to do that a lot myself. I remember the frustration in the community around this, growing as adoption increased[^1]. I’ve found myself doing this in Python a few times too, and I’ve grown concerned that it’ll add some of the same confusion, frustration or just friction for our users. For this reason, I think we should default to talk about Python SDK modules using the class, instead of top-level functions, in the documentation and examples. It also makes it more consistent with Go and TypeScript. [^1]: They eventually fixed it by making classes obsolete and have full-featured hooks in functions. ## Deprecation I have no plans, nor do I suggest, to deprecate top-level functions at this point. They’ll still be available, just more hidden. We’ll revisit at a later time. \cc @vikram-dagger @jpadams
https://github.com/dagger/dagger/issues/6728
https://github.com/dagger/dagger/pull/6729
e64f185334734a37a2f18a95ec3cf21a27e32437
4b7ab1e217d1f2da30723905282ba3cf27de8cab
"2024-02-24T00:58:03Z"
go
"2024-02-26T19:06:17Z"
internal/mage/util/engine.go
ConfigEntries map[string]string ConfigKeys []string } tmpl := template.Must(template.New("config").Parse(engineConfigTmpl)) buf := new(bytes.Buffer) err := tmpl.Execute(buf, configTmplParams{ ConfigEntries: mergedOpts, ConfigKeys: keys, }) if err != nil { panic(err) } config = buf.String() return config, nil } func CIDevEngineContainerAndEndpoint(ctx context.Context, c *dagger.Client, opts ...DevEngineOpts) (*dagger.Service, string, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,728
Zenith: default to use a class instead of top-level functions in Python
## Summary Change the `dagger init` template for Python to use a class instead of just functions. Also update documentation snippets to do the same. ## Motivation In an earlier iteration of Dagger modules, when the concept of objects that contain functions were introduced, the Python SDK kept the convenience of being able to define simple top-level functions, without having to convert into a class. Python allows this by transparently β€œcreating” the object and associate the top-level functions with it, behind the scenes. It provides a nicer experience for simple use cases, where users don’t have to get the name right for the class, since it has to match the module name. However, you can’t add a description to the main object this way. And over time we’ve added state to object types, and constructors to initialize that state. Using state has become a common pattern, so a user may **quite often need to convert the top-level functions into a class**. That takes me back to a few years ago, working with React. You used to be able to create components using either a function or a class. Most people prefer the simplicity of functions, but in React, if you reached a point where you needed to access some lifecycle hooks, you’d need to convert the function into a class. I had to do that a lot myself. I remember the frustration in the community around this, growing as adoption increased[^1]. I’ve found myself doing this in Python a few times too, and I’ve grown concerned that it’ll add some of the same confusion, frustration or just friction for our users. For this reason, I think we should default to talk about Python SDK modules using the class, instead of top-level functions, in the documentation and examples. It also makes it more consistent with Go and TypeScript. [^1]: They eventually fixed it by making classes obsolete and have full-featured hooks in functions. ## Deprecation I have no plans, nor do I suggest, to deprecate top-level functions at this point. They’ll still be available, just more hidden. We’ll revisit at a later time. \cc @vikram-dagger @jpadams
https://github.com/dagger/dagger/issues/6728
https://github.com/dagger/dagger/pull/6729
e64f185334734a37a2f18a95ec3cf21a27e32437
4b7ab1e217d1f2da30723905282ba3cf27de8cab
"2024-02-24T00:58:03Z"
go
"2024-02-26T19:06:17Z"
internal/mage/util/engine.go
devEngine := CIDevEngineContainer(ctx, c, opts...).AsService() endpoint, err := devEngine.Endpoint(ctx, dagger.ServiceEndpointOpts{Port: 1234, Scheme: "tcp"}) if err != nil { return nil, "", err } return devEngine, endpoint, nil } var DefaultDevEngineOpts = DevEngineOpts{ EntrypointArgs: map[string]string{ "network-name": "dagger-dev", "network-cidr": "10.88.0.0/16", }, ConfigEntries: map[string]string{ "grpc": `address=["unix:///var/run/buildkit/buildkitd.sock", "tcp://0.0.0.0:1234"]`, `registry."docker.io"`: `mirrors = ["mirror.gcr.io"]`, }, } func CIDevEngineContainer(ctx context.Context, c *dagger.Client, opts ...DevEngineOpts) *dagger.Container {
closed
dagger/dagger
https://github.com/dagger/dagger
6,728
Zenith: default to use a class instead of top-level functions in Python
## Summary Change the `dagger init` template for Python to use a class instead of just functions. Also update documentation snippets to do the same. ## Motivation In an earlier iteration of Dagger modules, when the concept of objects that contain functions were introduced, the Python SDK kept the convenience of being able to define simple top-level functions, without having to convert into a class. Python allows this by transparently β€œcreating” the object and associate the top-level functions with it, behind the scenes. It provides a nicer experience for simple use cases, where users don’t have to get the name right for the class, since it has to match the module name. However, you can’t add a description to the main object this way. And over time we’ve added state to object types, and constructors to initialize that state. Using state has become a common pattern, so a user may **quite often need to convert the top-level functions into a class**. That takes me back to a few years ago, working with React. You used to be able to create components using either a function or a class. Most people prefer the simplicity of functions, but in React, if you reached a point where you needed to access some lifecycle hooks, you’d need to convert the function into a class. I had to do that a lot myself. I remember the frustration in the community around this, growing as adoption increased[^1]. I’ve found myself doing this in Python a few times too, and I’ve grown concerned that it’ll add some of the same confusion, frustration or just friction for our users. For this reason, I think we should default to talk about Python SDK modules using the class, instead of top-level functions, in the documentation and examples. It also makes it more consistent with Go and TypeScript. [^1]: They eventually fixed it by making classes obsolete and have full-featured hooks in functions. ## Deprecation I have no plans, nor do I suggest, to deprecate top-level functions at this point. They’ll still be available, just more hidden. We’ll revisit at a later time. \cc @vikram-dagger @jpadams
https://github.com/dagger/dagger/issues/6728
https://github.com/dagger/dagger/pull/6729
e64f185334734a37a2f18a95ec3cf21a27e32437
4b7ab1e217d1f2da30723905282ba3cf27de8cab
"2024-02-24T00:58:03Z"
go
"2024-02-26T19:06:17Z"
internal/mage/util/engine.go
versionInfo, err := DevelVersionInfo(ctx, c) if err != nil { panic(err) } engineOpts := []DevEngineOpts{} engineOpts = append(engineOpts, DefaultDevEngineOpts) engineOpts = append(engineOpts, opts...) var cacheVolumeName string if len(opts) > 0 { for _, opt := range opts { if opt.Name != "" { cacheVolumeName = opt.Name } } } if cacheVolumeName != "" { cacheVolumeName = "dagger-dev-engine-state-" + cacheVolumeName } else { cacheVolumeName = "dagger-dev-engine-state" } cacheVolumeName = cacheVolumeName + identity.NewID() devEngine := devEngineContainer(ctx, c, runtime.GOARCH, versionInfo.EngineVersion(), engineOpts...) devEngine = devEngine.WithExposedPort(1234, dagger.ContainerWithExposedPortOpts{Protocol: dagger.Tcp}). WithMountedCache(distconsts.EngineDefaultStateDir, c.CacheVolume(cacheVolumeName)). WithExec(nil, dagger.ContainerWithExecOpts{ InsecureRootCapabilities: true, ExperimentalPrivilegedNesting: true, }) return devEngine }
closed
dagger/dagger
https://github.com/dagger/dagger
6,728
Zenith: default to use a class instead of top-level functions in Python
## Summary Change the `dagger init` template for Python to use a class instead of just functions. Also update documentation snippets to do the same. ## Motivation In an earlier iteration of Dagger modules, when the concept of objects that contain functions were introduced, the Python SDK kept the convenience of being able to define simple top-level functions, without having to convert into a class. Python allows this by transparently β€œcreating” the object and associate the top-level functions with it, behind the scenes. It provides a nicer experience for simple use cases, where users don’t have to get the name right for the class, since it has to match the module name. However, you can’t add a description to the main object this way. And over time we’ve added state to object types, and constructors to initialize that state. Using state has become a common pattern, so a user may **quite often need to convert the top-level functions into a class**. That takes me back to a few years ago, working with React. You used to be able to create components using either a function or a class. Most people prefer the simplicity of functions, but in React, if you reached a point where you needed to access some lifecycle hooks, you’d need to convert the function into a class. I had to do that a lot myself. I remember the frustration in the community around this, growing as adoption increased[^1]. I’ve found myself doing this in Python a few times too, and I’ve grown concerned that it’ll add some of the same confusion, frustration or just friction for our users. For this reason, I think we should default to talk about Python SDK modules using the class, instead of top-level functions, in the documentation and examples. It also makes it more consistent with Go and TypeScript. [^1]: They eventually fixed it by making classes obsolete and have full-featured hooks in functions. ## Deprecation I have no plans, nor do I suggest, to deprecate top-level functions at this point. They’ll still be available, just more hidden. We’ll revisit at a later time. \cc @vikram-dagger @jpadams
https://github.com/dagger/dagger/issues/6728
https://github.com/dagger/dagger/pull/6729
e64f185334734a37a2f18a95ec3cf21a27e32437
4b7ab1e217d1f2da30723905282ba3cf27de8cab
"2024-02-24T00:58:03Z"
go
"2024-02-26T19:06:17Z"
internal/mage/util/engine.go
func DevEngineContainer(ctx context.Context, c *dagger.Client, arches []string, version string, opts ...DevEngineOpts) []*dagger.Container { return devEngineContainers(ctx, c, arches, version, opts...) } func DevEngineContainerWithGPUSupport(ctx context.Context, c *dagger.Client, arches []string, version string, opts ...DevEngineOpts) []*dagger.Container { containers := devEngineContainersWithGPUSupport(ctx, c, arches, version, opts...) return containers } func devEngineContainer(ctx context.Context, c *dagger.Client, arch string, version string, opts ...DevEngineOpts) *dagger.Container { if version == "" { panic("engine version must be specified") } engineConfig, err := getConfig(opts...) if err != nil { panic(err) } engineEntrypoint, err := getEntrypoint(opts...) if err != nil { panic(err) } container := c.Container(dagger.ContainerOpts{Platform: dagger.Platform("linux/" + arch)}). From("alpine:"+alpineVersion). WithEnvVariable("DAGGER_APK_CACHE_BUSTER", fmt.Sprintf("%d", time.Now().Truncate(24*time.Hour).Unix())). WithExec([]string{"apk", "upgrade"}). WithExec([]string{
closed
dagger/dagger
https://github.com/dagger/dagger
6,728
Zenith: default to use a class instead of top-level functions in Python
## Summary Change the `dagger init` template for Python to use a class instead of just functions. Also update documentation snippets to do the same. ## Motivation In an earlier iteration of Dagger modules, when the concept of objects that contain functions were introduced, the Python SDK kept the convenience of being able to define simple top-level functions, without having to convert into a class. Python allows this by transparently β€œcreating” the object and associate the top-level functions with it, behind the scenes. It provides a nicer experience for simple use cases, where users don’t have to get the name right for the class, since it has to match the module name. However, you can’t add a description to the main object this way. And over time we’ve added state to object types, and constructors to initialize that state. Using state has become a common pattern, so a user may **quite often need to convert the top-level functions into a class**. That takes me back to a few years ago, working with React. You used to be able to create components using either a function or a class. Most people prefer the simplicity of functions, but in React, if you reached a point where you needed to access some lifecycle hooks, you’d need to convert the function into a class. I had to do that a lot myself. I remember the frustration in the community around this, growing as adoption increased[^1]. I’ve found myself doing this in Python a few times too, and I’ve grown concerned that it’ll add some of the same confusion, frustration or just friction for our users. For this reason, I think we should default to talk about Python SDK modules using the class, instead of top-level functions, in the documentation and examples. It also makes it more consistent with Go and TypeScript. [^1]: They eventually fixed it by making classes obsolete and have full-featured hooks in functions. ## Deprecation I have no plans, nor do I suggest, to deprecate top-level functions at this point. They’ll still be available, just more hidden. We’ll revisit at a later time. \cc @vikram-dagger @jpadams
https://github.com/dagger/dagger/issues/6728
https://github.com/dagger/dagger/pull/6729
e64f185334734a37a2f18a95ec3cf21a27e32437
4b7ab1e217d1f2da30723905282ba3cf27de8cab
"2024-02-24T00:58:03Z"
go
"2024-02-26T19:06:17Z"
internal/mage/util/engine.go
"apk", "add", "--no-cache", "git", "openssh", "pigz", "xz", "iptables", "ip6tables", "dnsmasq", }). WithoutEnvVariable("DAGGER_APK_CACHE_BUSTER"). WithFile("/usr/local/bin/runc", runcBin(c, arch), dagger.ContainerWithFileOpts{ Permissions: 0o700, }). WithFile(engineShimPath, shimBin(c, arch, version)). WithFile(engineServerPath, engineBin(c, arch, version)). With(goSDKContent(ctx, c, arch)). With(pythonSDKContent(ctx, c, arch)). With(typescriptSDKContent(ctx, c, arch)). WithDirectory("/usr/local/bin", qemuBins(c, arch)). WithDirectory("/", cniPlugins(c, arch, false)). WithDirectory("/", dialstdioFiles(c, arch)). WithDirectory(distconsts.EngineDefaultStateDir, c.Directory()). WithNewFile(engineTomlPath, dagger.ContainerWithNewFileOpts{ Contents: engineConfig, Permissions: 0o600, }). WithNewFile(engineEntrypointPath, dagger.ContainerWithNewFileOpts{ Contents: engineEntrypoint, Permissions: 0o755, }) return container.WithEntrypoint([]string{filepath.Base(engineEntrypointPath)}) } func devEngineContainerWithGPUSupport(ctx context.Context, c *dagger.Client, arch string, version string, opts ...DevEngineOpts) *dagger.Container {
closed
dagger/dagger
https://github.com/dagger/dagger
6,728
Zenith: default to use a class instead of top-level functions in Python
## Summary Change the `dagger init` template for Python to use a class instead of just functions. Also update documentation snippets to do the same. ## Motivation In an earlier iteration of Dagger modules, when the concept of objects that contain functions were introduced, the Python SDK kept the convenience of being able to define simple top-level functions, without having to convert into a class. Python allows this by transparently β€œcreating” the object and associate the top-level functions with it, behind the scenes. It provides a nicer experience for simple use cases, where users don’t have to get the name right for the class, since it has to match the module name. However, you can’t add a description to the main object this way. And over time we’ve added state to object types, and constructors to initialize that state. Using state has become a common pattern, so a user may **quite often need to convert the top-level functions into a class**. That takes me back to a few years ago, working with React. You used to be able to create components using either a function or a class. Most people prefer the simplicity of functions, but in React, if you reached a point where you needed to access some lifecycle hooks, you’d need to convert the function into a class. I had to do that a lot myself. I remember the frustration in the community around this, growing as adoption increased[^1]. I’ve found myself doing this in Python a few times too, and I’ve grown concerned that it’ll add some of the same confusion, frustration or just friction for our users. For this reason, I think we should default to talk about Python SDK modules using the class, instead of top-level functions, in the documentation and examples. It also makes it more consistent with Go and TypeScript. [^1]: They eventually fixed it by making classes obsolete and have full-featured hooks in functions. ## Deprecation I have no plans, nor do I suggest, to deprecate top-level functions at this point. They’ll still be available, just more hidden. We’ll revisit at a later time. \cc @vikram-dagger @jpadams
https://github.com/dagger/dagger/issues/6728
https://github.com/dagger/dagger/pull/6729
e64f185334734a37a2f18a95ec3cf21a27e32437
4b7ab1e217d1f2da30723905282ba3cf27de8cab
"2024-02-24T00:58:03Z"
go
"2024-02-26T19:06:17Z"
internal/mage/util/engine.go
if arch != "amd64" { panic("unsupported architecture") } if version == "" { panic("engine version must be specified") } engineConfig, err := getConfig(opts...) if err != nil { panic(err) } engineEntrypoint, err := getEntrypoint(opts...) if err != nil { panic(err) } container := c.Container(dagger.ContainerOpts{Platform: dagger.Platform("linux/" + arch)}). From("ubuntu:"+ubuntuVersion). WithEnvVariable("DEBIAN_FRONTEND", "noninteractive").
closed
dagger/dagger
https://github.com/dagger/dagger
6,728
Zenith: default to use a class instead of top-level functions in Python
## Summary Change the `dagger init` template for Python to use a class instead of just functions. Also update documentation snippets to do the same. ## Motivation In an earlier iteration of Dagger modules, when the concept of objects that contain functions were introduced, the Python SDK kept the convenience of being able to define simple top-level functions, without having to convert into a class. Python allows this by transparently β€œcreating” the object and associate the top-level functions with it, behind the scenes. It provides a nicer experience for simple use cases, where users don’t have to get the name right for the class, since it has to match the module name. However, you can’t add a description to the main object this way. And over time we’ve added state to object types, and constructors to initialize that state. Using state has become a common pattern, so a user may **quite often need to convert the top-level functions into a class**. That takes me back to a few years ago, working with React. You used to be able to create components using either a function or a class. Most people prefer the simplicity of functions, but in React, if you reached a point where you needed to access some lifecycle hooks, you’d need to convert the function into a class. I had to do that a lot myself. I remember the frustration in the community around this, growing as adoption increased[^1]. I’ve found myself doing this in Python a few times too, and I’ve grown concerned that it’ll add some of the same confusion, frustration or just friction for our users. For this reason, I think we should default to talk about Python SDK modules using the class, instead of top-level functions, in the documentation and examples. It also makes it more consistent with Go and TypeScript. [^1]: They eventually fixed it by making classes obsolete and have full-featured hooks in functions. ## Deprecation I have no plans, nor do I suggest, to deprecate top-level functions at this point. They’ll still be available, just more hidden. We’ll revisit at a later time. \cc @vikram-dagger @jpadams
https://github.com/dagger/dagger/issues/6728
https://github.com/dagger/dagger/pull/6729
e64f185334734a37a2f18a95ec3cf21a27e32437
4b7ab1e217d1f2da30723905282ba3cf27de8cab
"2024-02-24T00:58:03Z"
go
"2024-02-26T19:06:17Z"
internal/mage/util/engine.go
WithExec([]string{"apt-get", "update"}). WithExec([]string{ "apt-get", "install", "-y", "iptables", "git", "dnsmasq-base", "network-manager", "gpg", "curl", }). WithFile("/usr/local/bin/runc", runcBin(c, arch), dagger.ContainerWithFileOpts{ Permissions: 0o700, }). WithFile(engineShimPath, shimBin(c, arch, version)). WithFile(engineServerPath, engineBin(c, arch, version)). With(goSDKContent(ctx, c, arch)). With(pythonSDKContent(ctx, c, arch)). With(typescriptSDKContent(ctx, c, arch)). WithDirectory("/usr/local/bin", qemuBins(c, arch)). WithDirectory("/", cniPlugins(c, arch, true)). WithDirectory("/", dialstdioFiles(c, arch)). WithDirectory(distconsts.EngineDefaultStateDir, c.Directory()). WithNewFile(engineTomlPath, dagger.ContainerWithNewFileOpts{ Contents: engineConfig, Permissions: 0o600, }). WithNewFile(engineEntrypointPath, dagger.ContainerWithNewFileOpts{ Contents: engineEntrypoint, Permissions: 0o755, }). With(nvidiaSetup) return container.WithEntrypoint([]string{filepath.Base(engineEntrypointPath)}) } func nvidiaSetup(ctr *dagger.Container) *dagger.Container {
closed
dagger/dagger
https://github.com/dagger/dagger
6,728
Zenith: default to use a class instead of top-level functions in Python
## Summary Change the `dagger init` template for Python to use a class instead of just functions. Also update documentation snippets to do the same. ## Motivation In an earlier iteration of Dagger modules, when the concept of objects that contain functions were introduced, the Python SDK kept the convenience of being able to define simple top-level functions, without having to convert into a class. Python allows this by transparently β€œcreating” the object and associate the top-level functions with it, behind the scenes. It provides a nicer experience for simple use cases, where users don’t have to get the name right for the class, since it has to match the module name. However, you can’t add a description to the main object this way. And over time we’ve added state to object types, and constructors to initialize that state. Using state has become a common pattern, so a user may **quite often need to convert the top-level functions into a class**. That takes me back to a few years ago, working with React. You used to be able to create components using either a function or a class. Most people prefer the simplicity of functions, but in React, if you reached a point where you needed to access some lifecycle hooks, you’d need to convert the function into a class. I had to do that a lot myself. I remember the frustration in the community around this, growing as adoption increased[^1]. I’ve found myself doing this in Python a few times too, and I’ve grown concerned that it’ll add some of the same confusion, frustration or just friction for our users. For this reason, I think we should default to talk about Python SDK modules using the class, instead of top-level functions, in the documentation and examples. It also makes it more consistent with Go and TypeScript. [^1]: They eventually fixed it by making classes obsolete and have full-featured hooks in functions. ## Deprecation I have no plans, nor do I suggest, to deprecate top-level functions at this point. They’ll still be available, just more hidden. We’ll revisit at a later time. \cc @vikram-dagger @jpadams
https://github.com/dagger/dagger/issues/6728
https://github.com/dagger/dagger/pull/6729
e64f185334734a37a2f18a95ec3cf21a27e32437
4b7ab1e217d1f2da30723905282ba3cf27de8cab
"2024-02-24T00:58:03Z"
go
"2024-02-26T19:06:17Z"
internal/mage/util/engine.go
return ctr. With(shellExec(`curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg`)). With(shellExec(`curl -s -L https://nvidia.github.io/libnvidia-container/experimental/"$(. /etc/os-release;echo $ID$VERSION_ID)"/libnvidia-container.list | sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | tee /etc/apt/sources.list.d/nvidia-container-toolkit.list`)). With(shellExec(`apt-get update && apt-get install -y nvidia-container-toolkit`)) } func shellExec(cmd string) dagger.WithContainerFunc { return func(ctr *dagger.Container) *dagger.Container { return ctr.WithExec([]string{"sh", "-c", cmd}) } } func devEngineContainers(ctx context.Context, c *dagger.Client, arches []string, version string, opts ...DevEngineOpts) []*dagger.Container { platformVariants := make([]*dagger.Container, 0, len(arches)) for _, arch := range arches { platformVariants = append(platformVariants, devEngineContainer(ctx, c, arch, version, opts...)) } return platformVariants } func devEngineContainersWithGPUSupport(ctx context.Context, c *dagger.Client, arches []string, version string, opts ...DevEngineOpts) []*dagger.Container { platformVariants := make([]*dagger.Container, 0, len(arches)) platformVariants = append(platformVariants, devEngineContainerWithGPUSupport(ctx, c, "amd64", version, opts...)) return platformVariants } func pythonSDKContent(ctx context.Context, c *dagger.Client, arch string) dagger.WithContainerFunc {
closed
dagger/dagger
https://github.com/dagger/dagger
6,728
Zenith: default to use a class instead of top-level functions in Python
## Summary Change the `dagger init` template for Python to use a class instead of just functions. Also update documentation snippets to do the same. ## Motivation In an earlier iteration of Dagger modules, when the concept of objects that contain functions were introduced, the Python SDK kept the convenience of being able to define simple top-level functions, without having to convert into a class. Python allows this by transparently β€œcreating” the object and associate the top-level functions with it, behind the scenes. It provides a nicer experience for simple use cases, where users don’t have to get the name right for the class, since it has to match the module name. However, you can’t add a description to the main object this way. And over time we’ve added state to object types, and constructors to initialize that state. Using state has become a common pattern, so a user may **quite often need to convert the top-level functions into a class**. That takes me back to a few years ago, working with React. You used to be able to create components using either a function or a class. Most people prefer the simplicity of functions, but in React, if you reached a point where you needed to access some lifecycle hooks, you’d need to convert the function into a class. I had to do that a lot myself. I remember the frustration in the community around this, growing as adoption increased[^1]. I’ve found myself doing this in Python a few times too, and I’ve grown concerned that it’ll add some of the same confusion, frustration or just friction for our users. For this reason, I think we should default to talk about Python SDK modules using the class, instead of top-level functions, in the documentation and examples. It also makes it more consistent with Go and TypeScript. [^1]: They eventually fixed it by making classes obsolete and have full-featured hooks in functions. ## Deprecation I have no plans, nor do I suggest, to deprecate top-level functions at this point. They’ll still be available, just more hidden. We’ll revisit at a later time. \cc @vikram-dagger @jpadams
https://github.com/dagger/dagger/issues/6728
https://github.com/dagger/dagger/pull/6729
e64f185334734a37a2f18a95ec3cf21a27e32437
4b7ab1e217d1f2da30723905282ba3cf27de8cab
"2024-02-24T00:58:03Z"
go
"2024-02-26T19:06:17Z"
internal/mage/util/engine.go
return func(ctr *dagger.Container) *dagger.Container { sdkCtrTarball := c.Container(). WithRootfs(c.Host().Directory("sdk/python", dagger.HostDirectoryOpts{ Include: []string{ "pyproject.toml", "src/**/*.py", "src/**/*.typed", "runtime/", "LICENSE", "README.md", "dagger.json", }, })). WithFile("/codegen", goSDKCodegenBin(c, arch)). AsTarball(dagger.ContainerAsTarballOpts{ ForcedCompression: dagger.Uncompressed, }) sdkDir := c.Container().From("alpine:"+alpineVersion). WithMountedDirectory("/out", c.Directory()). WithMountedFile("/sdk.tar", sdkCtrTarball). WithExec([]string{"tar", "xf", "/sdk.tar", "-C", "/out"}). Directory("/out") return sdkContent(ctx, ctr, sdkDir, distconsts.PythonSDKManifestDigestEnvName) } } func typescriptSDKContent(ctx context.Context, c *dagger.Client, arch string) dagger.WithContainerFunc {
closed
dagger/dagger
https://github.com/dagger/dagger
6,728
Zenith: default to use a class instead of top-level functions in Python
## Summary Change the `dagger init` template for Python to use a class instead of just functions. Also update documentation snippets to do the same. ## Motivation In an earlier iteration of Dagger modules, when the concept of objects that contain functions were introduced, the Python SDK kept the convenience of being able to define simple top-level functions, without having to convert into a class. Python allows this by transparently β€œcreating” the object and associate the top-level functions with it, behind the scenes. It provides a nicer experience for simple use cases, where users don’t have to get the name right for the class, since it has to match the module name. However, you can’t add a description to the main object this way. And over time we’ve added state to object types, and constructors to initialize that state. Using state has become a common pattern, so a user may **quite often need to convert the top-level functions into a class**. That takes me back to a few years ago, working with React. You used to be able to create components using either a function or a class. Most people prefer the simplicity of functions, but in React, if you reached a point where you needed to access some lifecycle hooks, you’d need to convert the function into a class. I had to do that a lot myself. I remember the frustration in the community around this, growing as adoption increased[^1]. I’ve found myself doing this in Python a few times too, and I’ve grown concerned that it’ll add some of the same confusion, frustration or just friction for our users. For this reason, I think we should default to talk about Python SDK modules using the class, instead of top-level functions, in the documentation and examples. It also makes it more consistent with Go and TypeScript. [^1]: They eventually fixed it by making classes obsolete and have full-featured hooks in functions. ## Deprecation I have no plans, nor do I suggest, to deprecate top-level functions at this point. They’ll still be available, just more hidden. We’ll revisit at a later time. \cc @vikram-dagger @jpadams
https://github.com/dagger/dagger/issues/6728
https://github.com/dagger/dagger/pull/6729
e64f185334734a37a2f18a95ec3cf21a27e32437
4b7ab1e217d1f2da30723905282ba3cf27de8cab
"2024-02-24T00:58:03Z"
go
"2024-02-26T19:06:17Z"
internal/mage/util/engine.go
return func(ctr *dagger.Container) *dagger.Container { sdkCtrTarball := c.Container(). WithRootfs(c.Host().Directory("sdk/typescript", dagger.HostDirectoryOpts{ Include: []string{ "**/*.ts", "LICENSE", "README.md", "runtime", "package.json", "dagger.json", }, Exclude: []string{ "node_modules", "dist", "**/test", "**/*.spec.ts", "dev", }, })). WithFile("/codegen", goSDKCodegenBin(c, arch)). AsTarball(dagger.ContainerAsTarballOpts{
closed
dagger/dagger
https://github.com/dagger/dagger
6,728
Zenith: default to use a class instead of top-level functions in Python
## Summary Change the `dagger init` template for Python to use a class instead of just functions. Also update documentation snippets to do the same. ## Motivation In an earlier iteration of Dagger modules, when the concept of objects that contain functions were introduced, the Python SDK kept the convenience of being able to define simple top-level functions, without having to convert into a class. Python allows this by transparently β€œcreating” the object and associate the top-level functions with it, behind the scenes. It provides a nicer experience for simple use cases, where users don’t have to get the name right for the class, since it has to match the module name. However, you can’t add a description to the main object this way. And over time we’ve added state to object types, and constructors to initialize that state. Using state has become a common pattern, so a user may **quite often need to convert the top-level functions into a class**. That takes me back to a few years ago, working with React. You used to be able to create components using either a function or a class. Most people prefer the simplicity of functions, but in React, if you reached a point where you needed to access some lifecycle hooks, you’d need to convert the function into a class. I had to do that a lot myself. I remember the frustration in the community around this, growing as adoption increased[^1]. I’ve found myself doing this in Python a few times too, and I’ve grown concerned that it’ll add some of the same confusion, frustration or just friction for our users. For this reason, I think we should default to talk about Python SDK modules using the class, instead of top-level functions, in the documentation and examples. It also makes it more consistent with Go and TypeScript. [^1]: They eventually fixed it by making classes obsolete and have full-featured hooks in functions. ## Deprecation I have no plans, nor do I suggest, to deprecate top-level functions at this point. They’ll still be available, just more hidden. We’ll revisit at a later time. \cc @vikram-dagger @jpadams
https://github.com/dagger/dagger/issues/6728
https://github.com/dagger/dagger/pull/6729
e64f185334734a37a2f18a95ec3cf21a27e32437
4b7ab1e217d1f2da30723905282ba3cf27de8cab
"2024-02-24T00:58:03Z"
go
"2024-02-26T19:06:17Z"
internal/mage/util/engine.go
ForcedCompression: dagger.Uncompressed, }) sdkDir := c.Container().From("alpine:"+alpineVersion). WithMountedDirectory("/out", c.Directory()). WithMountedFile("/sdk.tar", sdkCtrTarball). WithExec([]string{"tar", "xf", "/sdk.tar", "-C", "/out"}). Directory("/out") return sdkContent(ctx, ctr, sdkDir, distconsts.TypescriptSDKManifestDigestEnvName) } } func goSDKContent(ctx context.Context, c *dagger.Client, arch string) dagger.WithContainerFunc { return func(ctr *dagger.Container) *dagger.Container { base := c.Container(dagger.ContainerOpts{Platform: dagger.Platform("linux/" + arch)}). From(fmt.Sprintf("golang:%s-alpine%s", golangVersion, alpineVersion)) sdkCtrTarball := base. WithEnvVariable("GOTOOLCHAIN", "auto"). WithFile("/usr/local/bin/codegen", goSDKCodegenBin(c, arch)). WithEntrypoint([]string{"/usr/local/bin/codegen"}). AsTarball(dagger.ContainerAsTarballOpts{ ForcedCompression: dagger.Uncompressed, }) sdkDir := base. WithMountedDirectory("/out", c.Directory()). WithMountedFile("/sdk.tar", sdkCtrTarball). WithExec([]string{"tar", "xf", "/sdk.tar", "-C", "/out"}). Directory("/out") return sdkContent(ctx, ctr, sdkDir, distconsts.GoSDKManifestDigestEnvName) } } func sdkContent(ctx context.Context, ctr *dagger.Container, sdkDir *dagger.Directory, envName string) *dagger.Container {
closed
dagger/dagger
https://github.com/dagger/dagger
6,728
Zenith: default to use a class instead of top-level functions in Python
## Summary Change the `dagger init` template for Python to use a class instead of just functions. Also update documentation snippets to do the same. ## Motivation In an earlier iteration of Dagger modules, when the concept of objects that contain functions were introduced, the Python SDK kept the convenience of being able to define simple top-level functions, without having to convert into a class. Python allows this by transparently β€œcreating” the object and associate the top-level functions with it, behind the scenes. It provides a nicer experience for simple use cases, where users don’t have to get the name right for the class, since it has to match the module name. However, you can’t add a description to the main object this way. And over time we’ve added state to object types, and constructors to initialize that state. Using state has become a common pattern, so a user may **quite often need to convert the top-level functions into a class**. That takes me back to a few years ago, working with React. You used to be able to create components using either a function or a class. Most people prefer the simplicity of functions, but in React, if you reached a point where you needed to access some lifecycle hooks, you’d need to convert the function into a class. I had to do that a lot myself. I remember the frustration in the community around this, growing as adoption increased[^1]. I’ve found myself doing this in Python a few times too, and I’ve grown concerned that it’ll add some of the same confusion, frustration or just friction for our users. For this reason, I think we should default to talk about Python SDK modules using the class, instead of top-level functions, in the documentation and examples. It also makes it more consistent with Go and TypeScript. [^1]: They eventually fixed it by making classes obsolete and have full-featured hooks in functions. ## Deprecation I have no plans, nor do I suggest, to deprecate top-level functions at this point. They’ll still be available, just more hidden. We’ll revisit at a later time. \cc @vikram-dagger @jpadams
https://github.com/dagger/dagger/issues/6728
https://github.com/dagger/dagger/pull/6729
e64f185334734a37a2f18a95ec3cf21a27e32437
4b7ab1e217d1f2da30723905282ba3cf27de8cab
"2024-02-24T00:58:03Z"
go
"2024-02-26T19:06:17Z"
internal/mage/util/engine.go
var index ocispecs.Index indexContents, err := sdkDir.File("index.json").Contents(ctx) if err != nil { panic(err) } if err := json.Unmarshal([]byte(indexContents), &index); err != nil { panic(err) } manifest := index.Manifests[0] manifestDgst := manifest.Digest.String() return ctr. WithEnvVariable(envName, manifestDgst). WithDirectory(distconsts.EngineContainerBuiltinContentDir, sdkDir, dagger.ContainerWithDirectoryOpts{ Include: []string{"blobs/"}, }) } func goSDKCodegenBin(c *dagger.Client, arch string) *dagger.File {
closed
dagger/dagger
https://github.com/dagger/dagger
6,728
Zenith: default to use a class instead of top-level functions in Python
## Summary Change the `dagger init` template for Python to use a class instead of just functions. Also update documentation snippets to do the same. ## Motivation In an earlier iteration of Dagger modules, when the concept of objects that contain functions were introduced, the Python SDK kept the convenience of being able to define simple top-level functions, without having to convert into a class. Python allows this by transparently β€œcreating” the object and associate the top-level functions with it, behind the scenes. It provides a nicer experience for simple use cases, where users don’t have to get the name right for the class, since it has to match the module name. However, you can’t add a description to the main object this way. And over time we’ve added state to object types, and constructors to initialize that state. Using state has become a common pattern, so a user may **quite often need to convert the top-level functions into a class**. That takes me back to a few years ago, working with React. You used to be able to create components using either a function or a class. Most people prefer the simplicity of functions, but in React, if you reached a point where you needed to access some lifecycle hooks, you’d need to convert the function into a class. I had to do that a lot myself. I remember the frustration in the community around this, growing as adoption increased[^1]. I’ve found myself doing this in Python a few times too, and I’ve grown concerned that it’ll add some of the same confusion, frustration or just friction for our users. For this reason, I think we should default to talk about Python SDK modules using the class, instead of top-level functions, in the documentation and examples. It also makes it more consistent with Go and TypeScript. [^1]: They eventually fixed it by making classes obsolete and have full-featured hooks in functions. ## Deprecation I have no plans, nor do I suggest, to deprecate top-level functions at this point. They’ll still be available, just more hidden. We’ll revisit at a later time. \cc @vikram-dagger @jpadams
https://github.com/dagger/dagger/issues/6728
https://github.com/dagger/dagger/pull/6729
e64f185334734a37a2f18a95ec3cf21a27e32437
4b7ab1e217d1f2da30723905282ba3cf27de8cab
"2024-02-24T00:58:03Z"
go
"2024-02-26T19:06:17Z"
internal/mage/util/engine.go
return goBase(c). WithEnvVariable("GOOS", "linux"). WithEnvVariable("GOARCH", arch). WithExec([]string{ "go", "build", "-o", "./bin/codegen", "./cmd/codegen", }). File("./bin/codegen") } func cniPlugins(c *dagger.Client, arch string, gpuSupportEnabled bool) *dagger.Directory { ctr := c.Container() if gpuSupportEnabled { ctr = ctr.From(fmt.Sprintf("golang:%s-bullseye", golangVersion)). WithExec([]string{"apt-get", "update"}). WithExec([]string{"apt-get", "install", "-y", "git", "build-essential"}) } else { ctr = ctr.From(fmt.Sprintf("golang:%s-alpine%s", golangVersion, alpineVersion)). WithExec([]string{"apk", "add", "build-base", "go", "git"}) } ctr = ctr.WithMountedCache("/root/go/pkg/mod", c.CacheVolume("go-mod")). WithMountedCache("/root/.cache/go-build", c.CacheVolume("go-build")). WithMountedDirectory("/src", c.Git("github.com/containernetworking/plugins").Tag(cniVersion).Tree()).
closed
dagger/dagger
https://github.com/dagger/dagger
6,728
Zenith: default to use a class instead of top-level functions in Python
## Summary Change the `dagger init` template for Python to use a class instead of just functions. Also update documentation snippets to do the same. ## Motivation In an earlier iteration of Dagger modules, when the concept of objects that contain functions were introduced, the Python SDK kept the convenience of being able to define simple top-level functions, without having to convert into a class. Python allows this by transparently β€œcreating” the object and associate the top-level functions with it, behind the scenes. It provides a nicer experience for simple use cases, where users don’t have to get the name right for the class, since it has to match the module name. However, you can’t add a description to the main object this way. And over time we’ve added state to object types, and constructors to initialize that state. Using state has become a common pattern, so a user may **quite often need to convert the top-level functions into a class**. That takes me back to a few years ago, working with React. You used to be able to create components using either a function or a class. Most people prefer the simplicity of functions, but in React, if you reached a point where you needed to access some lifecycle hooks, you’d need to convert the function into a class. I had to do that a lot myself. I remember the frustration in the community around this, growing as adoption increased[^1]. I’ve found myself doing this in Python a few times too, and I’ve grown concerned that it’ll add some of the same confusion, frustration or just friction for our users. For this reason, I think we should default to talk about Python SDK modules using the class, instead of top-level functions, in the documentation and examples. It also makes it more consistent with Go and TypeScript. [^1]: They eventually fixed it by making classes obsolete and have full-featured hooks in functions. ## Deprecation I have no plans, nor do I suggest, to deprecate top-level functions at this point. They’ll still be available, just more hidden. We’ll revisit at a later time. \cc @vikram-dagger @jpadams
https://github.com/dagger/dagger/issues/6728
https://github.com/dagger/dagger/pull/6729
e64f185334734a37a2f18a95ec3cf21a27e32437
4b7ab1e217d1f2da30723905282ba3cf27de8cab
"2024-02-24T00:58:03Z"
go
"2024-02-26T19:06:17Z"
internal/mage/util/engine.go
WithWorkdir("/src"). WithEnvVariable("GOARCH", arch) pluginDir := c.Directory().WithFile("/opt/cni/bin/dnsname", dnsnameBinary(c, arch)) for _, pluginPath := range []string{ "plugins/main/bridge", "plugins/main/loopback", "plugins/meta/firewall", "plugins/ipam/host-local", } { pluginName := filepath.Base(pluginPath) pluginDir = pluginDir.WithFile(filepath.Join("/opt/cni/bin", pluginName), ctr. WithWorkdir(pluginPath). WithExec([]string{"go", "build", "-o", pluginName, "-ldflags", "-s -w", "."}). File(pluginName)) } return pluginDir } func dnsnameBinary(c *dagger.Client, arch string) *dagger.File { return goBase(c). WithEnvVariable("GOOS", "linux"). WithEnvVariable("GOARCH", arch). WithExec([]string{ "go", "build", "-o", "./bin/dnsname", "-ldflags", "-s -w", "/app/cmd/dnsname", }). File("./bin/dnsname") } func dialstdioFiles(c *dagger.Client, arch string) *dagger.Directory {
closed
dagger/dagger
https://github.com/dagger/dagger
6,728
Zenith: default to use a class instead of top-level functions in Python
## Summary Change the `dagger init` template for Python to use a class instead of just functions. Also update documentation snippets to do the same. ## Motivation In an earlier iteration of Dagger modules, when the concept of objects that contain functions were introduced, the Python SDK kept the convenience of being able to define simple top-level functions, without having to convert into a class. Python allows this by transparently β€œcreating” the object and associate the top-level functions with it, behind the scenes. It provides a nicer experience for simple use cases, where users don’t have to get the name right for the class, since it has to match the module name. However, you can’t add a description to the main object this way. And over time we’ve added state to object types, and constructors to initialize that state. Using state has become a common pattern, so a user may **quite often need to convert the top-level functions into a class**. That takes me back to a few years ago, working with React. You used to be able to create components using either a function or a class. Most people prefer the simplicity of functions, but in React, if you reached a point where you needed to access some lifecycle hooks, you’d need to convert the function into a class. I had to do that a lot myself. I remember the frustration in the community around this, growing as adoption increased[^1]. I’ve found myself doing this in Python a few times too, and I’ve grown concerned that it’ll add some of the same confusion, frustration or just friction for our users. For this reason, I think we should default to talk about Python SDK modules using the class, instead of top-level functions, in the documentation and examples. It also makes it more consistent with Go and TypeScript. [^1]: They eventually fixed it by making classes obsolete and have full-featured hooks in functions. ## Deprecation I have no plans, nor do I suggest, to deprecate top-level functions at this point. They’ll still be available, just more hidden. We’ll revisit at a later time. \cc @vikram-dagger @jpadams
https://github.com/dagger/dagger/issues/6728
https://github.com/dagger/dagger/pull/6729
e64f185334734a37a2f18a95ec3cf21a27e32437
4b7ab1e217d1f2da30723905282ba3cf27de8cab
"2024-02-24T00:58:03Z"
go
"2024-02-26T19:06:17Z"
internal/mage/util/engine.go
outDir := "/out" installPath := filepath.Dir(engineDialStdioPath) buildArgs := []string{ "go", "build", "-o", filepath.Join(outDir, installPath, filepath.Base(engineDialStdioPath)), "-ldflags", } ldflags := []string{"-s", "-w"} buildArgs = append(buildArgs, strings.Join(ldflags, " ")) buildArgs = append(buildArgs, "/app/cmd/dialstdio") return goBase(c). WithEnvVariable("GOOS", "linux"). WithEnvVariable("GOARCH", arch). WithEnvVariable("CGO_ENABLED", "0"). WithMountedDirectory(outDir, c.Directory()). WithExec(buildArgs). WithExec([]string{"ln", "-s", filepath.Base(engineDialStdioPath), filepath.Join(outDir, installPath, "buildctl")}). Directory(outDir) } func runcBin(c *dagger.Client, arch string) *dagger.File {
closed
dagger/dagger
https://github.com/dagger/dagger
6,728
Zenith: default to use a class instead of top-level functions in Python
## Summary Change the `dagger init` template for Python to use a class instead of just functions. Also update documentation snippets to do the same. ## Motivation In an earlier iteration of Dagger modules, when the concept of objects that contain functions were introduced, the Python SDK kept the convenience of being able to define simple top-level functions, without having to convert into a class. Python allows this by transparently β€œcreating” the object and associate the top-level functions with it, behind the scenes. It provides a nicer experience for simple use cases, where users don’t have to get the name right for the class, since it has to match the module name. However, you can’t add a description to the main object this way. And over time we’ve added state to object types, and constructors to initialize that state. Using state has become a common pattern, so a user may **quite often need to convert the top-level functions into a class**. That takes me back to a few years ago, working with React. You used to be able to create components using either a function or a class. Most people prefer the simplicity of functions, but in React, if you reached a point where you needed to access some lifecycle hooks, you’d need to convert the function into a class. I had to do that a lot myself. I remember the frustration in the community around this, growing as adoption increased[^1]. I’ve found myself doing this in Python a few times too, and I’ve grown concerned that it’ll add some of the same confusion, frustration or just friction for our users. For this reason, I think we should default to talk about Python SDK modules using the class, instead of top-level functions, in the documentation and examples. It also makes it more consistent with Go and TypeScript. [^1]: They eventually fixed it by making classes obsolete and have full-featured hooks in functions. ## Deprecation I have no plans, nor do I suggest, to deprecate top-level functions at this point. They’ll still be available, just more hidden. We’ll revisit at a later time. \cc @vikram-dagger @jpadams
https://github.com/dagger/dagger/issues/6728
https://github.com/dagger/dagger/pull/6729
e64f185334734a37a2f18a95ec3cf21a27e32437
4b7ab1e217d1f2da30723905282ba3cf27de8cab
"2024-02-24T00:58:03Z"
go
"2024-02-26T19:06:17Z"
internal/mage/util/engine.go
buildCtr := c.Container(). From(fmt.Sprintf("golang:%s-alpine%s", golangVersion, alpineVersion)). WithEnvVariable("GOARCH", arch). WithEnvVariable("BUILDPLATFORM", "linux/"+runtime.GOARCH). WithEnvVariable("TARGETPLATFORM", "linux/"+arch). WithEnvVariable("CGO_ENABLED", "1"). WithExec([]string{"apk", "add", "clang", "lld", "git", "pkgconf"}). WithDirectory("/", c.Container().From("tonistiigi/xx:1.2.1").Rootfs()). WithExec([]string{"xx-apk", "update"}). WithExec([]string{"xx-apk", "add", "build-base", "pkgconf", "libseccomp-dev", "libseccomp-static"}). WithMountedCache("/go/pkg/mod", c.CacheVolume("go-mod")). WithMountedCache("/root/.cache/go-build", c.CacheVolume("go-build")). WithMountedDirectory("/src", c.Git("github.com/opencontainers/runc").Tag(runcVersion).Tree()). WithWorkdir("/src") buildCtr = buildCtr.WithExec([]string{"go", "get", "golang.org/x/net"}). WithExec([]string{"go", "mod", "tidy"}). WithExec([]string{"go", "mod", "vendor"}) return buildCtr. WithExec([]string{"xx-go", "build", "-trimpath", "-buildmode=pie", "-tags", "seccomp netgo osusergo", "-ldflags", "-X main.version=" + runcVersion + " -linkmode external -extldflags -static-pie", "-o", "runc", "."}). File("runc") } func shimBin(c *dagger.Client, arch string, version string) *dagger.File {
closed
dagger/dagger
https://github.com/dagger/dagger
6,728
Zenith: default to use a class instead of top-level functions in Python
## Summary Change the `dagger init` template for Python to use a class instead of just functions. Also update documentation snippets to do the same. ## Motivation In an earlier iteration of Dagger modules, when the concept of objects that contain functions were introduced, the Python SDK kept the convenience of being able to define simple top-level functions, without having to convert into a class. Python allows this by transparently β€œcreating” the object and associate the top-level functions with it, behind the scenes. It provides a nicer experience for simple use cases, where users don’t have to get the name right for the class, since it has to match the module name. However, you can’t add a description to the main object this way. And over time we’ve added state to object types, and constructors to initialize that state. Using state has become a common pattern, so a user may **quite often need to convert the top-level functions into a class**. That takes me back to a few years ago, working with React. You used to be able to create components using either a function or a class. Most people prefer the simplicity of functions, but in React, if you reached a point where you needed to access some lifecycle hooks, you’d need to convert the function into a class. I had to do that a lot myself. I remember the frustration in the community around this, growing as adoption increased[^1]. I’ve found myself doing this in Python a few times too, and I’ve grown concerned that it’ll add some of the same confusion, frustration or just friction for our users. For this reason, I think we should default to talk about Python SDK modules using the class, instead of top-level functions, in the documentation and examples. It also makes it more consistent with Go and TypeScript. [^1]: They eventually fixed it by making classes obsolete and have full-featured hooks in functions. ## Deprecation I have no plans, nor do I suggest, to deprecate top-level functions at this point. They’ll still be available, just more hidden. We’ll revisit at a later time. \cc @vikram-dagger @jpadams
https://github.com/dagger/dagger/issues/6728
https://github.com/dagger/dagger/pull/6729
e64f185334734a37a2f18a95ec3cf21a27e32437
4b7ab1e217d1f2da30723905282ba3cf27de8cab
"2024-02-24T00:58:03Z"
go
"2024-02-26T19:06:17Z"
internal/mage/util/engine.go
return goBase(c). WithEnvVariable("GOOS", "linux"). WithEnvVariable("GOARCH", arch). WithExec([]string{ "go", "build", "-o", "./bin/" + filepath.Base(engineShimPath), "-ldflags", "-s -w -X github.com/dagger/dagger/engine.Version=" + version, "/app/cmd/shim", }). File("./bin/" + filepath.Base(engineShimPath)) } func engineBin(c *dagger.Client, arch string, version string) *dagger.File {
closed
dagger/dagger
https://github.com/dagger/dagger
6,728
Zenith: default to use a class instead of top-level functions in Python
## Summary Change the `dagger init` template for Python to use a class instead of just functions. Also update documentation snippets to do the same. ## Motivation In an earlier iteration of Dagger modules, when the concept of objects that contain functions were introduced, the Python SDK kept the convenience of being able to define simple top-level functions, without having to convert into a class. Python allows this by transparently β€œcreating” the object and associate the top-level functions with it, behind the scenes. It provides a nicer experience for simple use cases, where users don’t have to get the name right for the class, since it has to match the module name. However, you can’t add a description to the main object this way. And over time we’ve added state to object types, and constructors to initialize that state. Using state has become a common pattern, so a user may **quite often need to convert the top-level functions into a class**. That takes me back to a few years ago, working with React. You used to be able to create components using either a function or a class. Most people prefer the simplicity of functions, but in React, if you reached a point where you needed to access some lifecycle hooks, you’d need to convert the function into a class. I had to do that a lot myself. I remember the frustration in the community around this, growing as adoption increased[^1]. I’ve found myself doing this in Python a few times too, and I’ve grown concerned that it’ll add some of the same confusion, frustration or just friction for our users. For this reason, I think we should default to talk about Python SDK modules using the class, instead of top-level functions, in the documentation and examples. It also makes it more consistent with Go and TypeScript. [^1]: They eventually fixed it by making classes obsolete and have full-featured hooks in functions. ## Deprecation I have no plans, nor do I suggest, to deprecate top-level functions at this point. They’ll still be available, just more hidden. We’ll revisit at a later time. \cc @vikram-dagger @jpadams
https://github.com/dagger/dagger/issues/6728
https://github.com/dagger/dagger/pull/6729
e64f185334734a37a2f18a95ec3cf21a27e32437
4b7ab1e217d1f2da30723905282ba3cf27de8cab
"2024-02-24T00:58:03Z"
go
"2024-02-26T19:06:17Z"
internal/mage/util/engine.go
buildArgs := []string{ "go", "build", "-o", "/app/bin/" + filepath.Base(engineServerPath), } ldflags := []string{ "-s", "-w", "-X", "github.com/dagger/dagger/engine.Version=" + version, } buildArgs = append(buildArgs, "-ldflags", strings.Join(ldflags, " ")) return goBase(c). WithEnvVariable("GOOS", "linux"). WithEnvVariable("GOARCH", arch). WithWorkdir("/app/cmd/engine"). WithExec(buildArgs). File("/app/bin/" + filepath.Base(engineServerPath)) } func qemuBins(c *dagger.Client, arch string) *dagger.Directory { return c. Container(dagger.ContainerOpts{Platform: dagger.Platform("linux/" + arch)}). From(qemuBinImage). Rootfs() }
closed
dagger/dagger
https://github.com/dagger/dagger
6,728
Zenith: default to use a class instead of top-level functions in Python
## Summary Change the `dagger init` template for Python to use a class instead of just functions. Also update documentation snippets to do the same. ## Motivation In an earlier iteration of Dagger modules, when the concept of objects that contain functions were introduced, the Python SDK kept the convenience of being able to define simple top-level functions, without having to convert into a class. Python allows this by transparently β€œcreating” the object and associate the top-level functions with it, behind the scenes. It provides a nicer experience for simple use cases, where users don’t have to get the name right for the class, since it has to match the module name. However, you can’t add a description to the main object this way. And over time we’ve added state to object types, and constructors to initialize that state. Using state has become a common pattern, so a user may **quite often need to convert the top-level functions into a class**. That takes me back to a few years ago, working with React. You used to be able to create components using either a function or a class. Most people prefer the simplicity of functions, but in React, if you reached a point where you needed to access some lifecycle hooks, you’d need to convert the function into a class. I had to do that a lot myself. I remember the frustration in the community around this, growing as adoption increased[^1]. I’ve found myself doing this in Python a few times too, and I’ve grown concerned that it’ll add some of the same confusion, frustration or just friction for our users. For this reason, I think we should default to talk about Python SDK modules using the class, instead of top-level functions, in the documentation and examples. It also makes it more consistent with Go and TypeScript. [^1]: They eventually fixed it by making classes obsolete and have full-featured hooks in functions. ## Deprecation I have no plans, nor do I suggest, to deprecate top-level functions at this point. They’ll still be available, just more hidden. We’ll revisit at a later time. \cc @vikram-dagger @jpadams
https://github.com/dagger/dagger/issues/6728
https://github.com/dagger/dagger/pull/6729
e64f185334734a37a2f18a95ec3cf21a27e32437
4b7ab1e217d1f2da30723905282ba3cf27de8cab
"2024-02-24T00:58:03Z"
go
"2024-02-26T19:06:17Z"
sdk/python/runtime/main.go
package main import ( "context" _ "embed" "fmt" "path" ) func New( sdkSourceDir *Directory, ) *PythonSdk { return &PythonSdk{ SDKSourceDir: sdkSourceDir, RequiredPaths: []string{ "**/pyproject.toml", }, } } type PythonSdk struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,728
Zenith: default to use a class instead of top-level functions in Python
## Summary Change the `dagger init` template for Python to use a class instead of just functions. Also update documentation snippets to do the same. ## Motivation In an earlier iteration of Dagger modules, when the concept of objects that contain functions were introduced, the Python SDK kept the convenience of being able to define simple top-level functions, without having to convert into a class. Python allows this by transparently β€œcreating” the object and associate the top-level functions with it, behind the scenes. It provides a nicer experience for simple use cases, where users don’t have to get the name right for the class, since it has to match the module name. However, you can’t add a description to the main object this way. And over time we’ve added state to object types, and constructors to initialize that state. Using state has become a common pattern, so a user may **quite often need to convert the top-level functions into a class**. That takes me back to a few years ago, working with React. You used to be able to create components using either a function or a class. Most people prefer the simplicity of functions, but in React, if you reached a point where you needed to access some lifecycle hooks, you’d need to convert the function into a class. I had to do that a lot myself. I remember the frustration in the community around this, growing as adoption increased[^1]. I’ve found myself doing this in Python a few times too, and I’ve grown concerned that it’ll add some of the same confusion, frustration or just friction for our users. For this reason, I think we should default to talk about Python SDK modules using the class, instead of top-level functions, in the documentation and examples. It also makes it more consistent with Go and TypeScript. [^1]: They eventually fixed it by making classes obsolete and have full-featured hooks in functions. ## Deprecation I have no plans, nor do I suggest, to deprecate top-level functions at this point. They’ll still be available, just more hidden. We’ll revisit at a later time. \cc @vikram-dagger @jpadams
https://github.com/dagger/dagger/issues/6728
https://github.com/dagger/dagger/pull/6729
e64f185334734a37a2f18a95ec3cf21a27e32437
4b7ab1e217d1f2da30723905282ba3cf27de8cab
"2024-02-24T00:58:03Z"
go
"2024-02-26T19:06:17Z"
sdk/python/runtime/main.go
SDKSourceDir *Directory RequiredPaths []string } const ( ModSourceDirPath = "/src" RuntimeExecutablePath = "/runtime" venv = "/opt/venv" sdkSrc = "/sdk" genDir = "sdk" genPath = "src/dagger/client/gen.py" schemaPath = "/schema.json" defaultPythonVersion = "3.11-slim" defaultPythonDigest = "sha256:8f64a67710f3d981cf3008d6f9f1dbe61accd7927f165f4e37ea3f8b883ccc3f" ) var runtimeTmpl string func (m *PythonSdk) ModuleRuntime( ctx context.Context, modSource *ModuleSource, introspectionJson string, ) (*Container, error) { ctr, err := m.CodegenBase(ctx, modSource, introspectionJson) if err != nil { return nil, err } return ctr. WithExec([]string{"python", "-m", "pip", "install", "."}). WithNewFile(RuntimeExecutablePath, ContainerWithNewFileOpts{ Contents: runtimeTmpl, Permissions: 0755,
closed
dagger/dagger
https://github.com/dagger/dagger
6,728
Zenith: default to use a class instead of top-level functions in Python
## Summary Change the `dagger init` template for Python to use a class instead of just functions. Also update documentation snippets to do the same. ## Motivation In an earlier iteration of Dagger modules, when the concept of objects that contain functions were introduced, the Python SDK kept the convenience of being able to define simple top-level functions, without having to convert into a class. Python allows this by transparently β€œcreating” the object and associate the top-level functions with it, behind the scenes. It provides a nicer experience for simple use cases, where users don’t have to get the name right for the class, since it has to match the module name. However, you can’t add a description to the main object this way. And over time we’ve added state to object types, and constructors to initialize that state. Using state has become a common pattern, so a user may **quite often need to convert the top-level functions into a class**. That takes me back to a few years ago, working with React. You used to be able to create components using either a function or a class. Most people prefer the simplicity of functions, but in React, if you reached a point where you needed to access some lifecycle hooks, you’d need to convert the function into a class. I had to do that a lot myself. I remember the frustration in the community around this, growing as adoption increased[^1]. I’ve found myself doing this in Python a few times too, and I’ve grown concerned that it’ll add some of the same confusion, frustration or just friction for our users. For this reason, I think we should default to talk about Python SDK modules using the class, instead of top-level functions, in the documentation and examples. It also makes it more consistent with Go and TypeScript. [^1]: They eventually fixed it by making classes obsolete and have full-featured hooks in functions. ## Deprecation I have no plans, nor do I suggest, to deprecate top-level functions at this point. They’ll still be available, just more hidden. We’ll revisit at a later time. \cc @vikram-dagger @jpadams
https://github.com/dagger/dagger/issues/6728
https://github.com/dagger/dagger/pull/6729
e64f185334734a37a2f18a95ec3cf21a27e32437
4b7ab1e217d1f2da30723905282ba3cf27de8cab
"2024-02-24T00:58:03Z"
go
"2024-02-26T19:06:17Z"
sdk/python/runtime/main.go
}). WithEntrypoint([]string{RuntimeExecutablePath}), nil } func (m *PythonSdk) Codegen(ctx context.Context, modSource *ModuleSource, introspectionJson string) (*GeneratedCode, error) { ctr, err := m.CodegenBase(ctx, modSource, introspectionJson) if err != nil { return nil, err } ctr = ctr.WithDirectory(genDir, ctr.Directory(sdkSrc), ContainerWithDirectoryOpts{ Exclude: []string{ "**/__pycache__", }, }) return dag.GeneratedCode(ctr.Directory(ModSourceDirPath)). WithVCSGeneratedPaths( []string{genDir + "/**"}, ). WithVCSIgnoredPaths( []string{genDir}, ), nil } func (m *PythonSdk) CodegenBase(ctx context.Context, modSource *ModuleSource, introspectionJson string) (*Container, error) { subPath, err := modSource.SourceSubpath(ctx) if err != nil { return nil, fmt.Errorf("could not load module config: %v", err) } return m.Base(""). WithMountedDirectory(sdkSrc, m.SDKSourceDir.WithoutDirectory("runtime")). WithMountedDirectory("/opt", dag.CurrentModule().Source().Directory("./template")). WithExec([]string{"python", "-m", "pip", "install", "-e", sdkSrc}).
closed
dagger/dagger
https://github.com/dagger/dagger
6,728
Zenith: default to use a class instead of top-level functions in Python
## Summary Change the `dagger init` template for Python to use a class instead of just functions. Also update documentation snippets to do the same. ## Motivation In an earlier iteration of Dagger modules, when the concept of objects that contain functions were introduced, the Python SDK kept the convenience of being able to define simple top-level functions, without having to convert into a class. Python allows this by transparently β€œcreating” the object and associate the top-level functions with it, behind the scenes. It provides a nicer experience for simple use cases, where users don’t have to get the name right for the class, since it has to match the module name. However, you can’t add a description to the main object this way. And over time we’ve added state to object types, and constructors to initialize that state. Using state has become a common pattern, so a user may **quite often need to convert the top-level functions into a class**. That takes me back to a few years ago, working with React. You used to be able to create components using either a function or a class. Most people prefer the simplicity of functions, but in React, if you reached a point where you needed to access some lifecycle hooks, you’d need to convert the function into a class. I had to do that a lot myself. I remember the frustration in the community around this, growing as adoption increased[^1]. I’ve found myself doing this in Python a few times too, and I’ve grown concerned that it’ll add some of the same confusion, frustration or just friction for our users. For this reason, I think we should default to talk about Python SDK modules using the class, instead of top-level functions, in the documentation and examples. It also makes it more consistent with Go and TypeScript. [^1]: They eventually fixed it by making classes obsolete and have full-featured hooks in functions. ## Deprecation I have no plans, nor do I suggest, to deprecate top-level functions at this point. They’ll still be available, just more hidden. We’ll revisit at a later time. \cc @vikram-dagger @jpadams
https://github.com/dagger/dagger/issues/6728
https://github.com/dagger/dagger/pull/6729
e64f185334734a37a2f18a95ec3cf21a27e32437
4b7ab1e217d1f2da30723905282ba3cf27de8cab
"2024-02-24T00:58:03Z"
go
"2024-02-26T19:06:17Z"
sdk/python/runtime/main.go
WithMountedDirectory(ModSourceDirPath, modSource.ContextDirectory()). WithWorkdir(path.Join(ModSourceDirPath, subPath)). WithNewFile(schemaPath, ContainerWithNewFileOpts{ Contents: introspectionJson, }). WithExec([]string{ "python", "-m", "dagger", "codegen", "--output", path.Join(sdkSrc, genPath), "--introspection", schemaPath, }, ContainerWithExecOpts{ ExperimentalPrivilegedNesting: true, }). WithExec([]string{"sh", "-c", "[ -f pyproject.toml ] || cp /opt/pyproject.toml ."}). WithExec([]string{"sh", "-c", "find . -name '*.py' | grep -q . || { mkdir -p src; cp /opt/src/main.py src/main.py; }"}), nil } func (m *PythonSdk) Base(version string) *Container { if version == "" { version = defaultPythonVersion + "@" + defaultPythonDigest } return dag.Container(). From("python:"+version). WithMountedCache("/root/.cache/pip", dag.CacheVolume("modpipcache-"+version)). WithExec([]string{"python", "-m", "venv", venv}). WithEnvVariable("VIRTUAL_ENV", venv). WithEnvVariable("PATH", "$VIRTUAL_ENV/bin:$PATH", ContainerWithEnvVariableOpts{ Expand: true, }) }
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/buildkitcontroller.go
package server import ( "context" "errors" "fmt" "io" "runtime" "runtime/debug" "sync" "time" "github.com/dagger/dagger/auth" "github.com/dagger/dagger/core" "github.com/dagger/dagger/core/pipeline" "github.com/dagger/dagger/engine" "github.com/dagger/dagger/engine/buildkit" "github.com/dagger/dagger/engine/cache" controlapi "github.com/moby/buildkit/api/services/control"
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/buildkitcontroller.go
apitypes "github.com/moby/buildkit/api/types" "github.com/moby/buildkit/cache/remotecache" bkclient "github.com/moby/buildkit/client" "github.com/moby/buildkit/executor/oci" "github.com/moby/buildkit/frontend" bkgw "github.com/moby/buildkit/frontend/gateway/client" "github.com/moby/buildkit/identity" "github.com/moby/buildkit/session" "github.com/moby/buildkit/session/grpchijack" containerdsnapshot "github.com/moby/buildkit/snapshot/containerd" "github.com/moby/buildkit/solver" "github.com/moby/buildkit/solver/llbsolver" "github.com/moby/buildkit/solver/pb" "github.com/moby/buildkit/util/bklog" "github.com/moby/buildkit/util/entitlements" "github.com/moby/buildkit/util/imageutil" "github.com/moby/buildkit/util/leaseutil" "github.com/moby/buildkit/util/throttle" "github.com/moby/buildkit/util/tracing/transform" bkworker "github.com/moby/buildkit/worker" "github.com/moby/locker" "github.com/sirupsen/logrus" "go.opentelemetry.io/otel/sdk/trace" tracev1 "go.opentelemetry.io/proto/otlp/collector/trace/v1" "golang.org/x/sync/errgroup" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) type BuildkitController struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/buildkitcontroller.go
BuildkitControllerOpts *tracev1.UnimplementedTraceServiceServer llbSolver *llbsolver.Solver genericSolver *solver.Solver cacheManager solver.CacheManager worker bkworker.Worker privilegedExecEnabled bool servers map[string]*DaggerServer serverMu sync.RWMutex perServerMu *locker.Locker throttledGC func() gcmu sync.Mutex } type BuildkitControllerOpts struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/buildkitcontroller.go
WorkerController *bkworker.Controller SessionManager *session.Manager CacheManager solver.CacheManager ContentStore *containerdsnapshot.Store LeaseManager *leaseutil.Manager Entitlements []string EngineName string Frontends map[string]frontend.Frontend TraceCollector trace.SpanExporter UpstreamCacheExporters map[string]remotecache.ResolveCacheExporterFunc UpstreamCacheImporters map[string]remotecache.ResolveCacheImporterFunc DNSConfig *oci.DNSConfig } func NewBuildkitController(opts BuildkitControllerOpts) (*BuildkitController, error) { w, err := opts.WorkerController.GetDefault() if err != nil { return nil, fmt.Errorf("failed to get default worker: %w", err) } llbSolver, err := llbsolver.New(llbsolver.Opt{ WorkerController: opts.WorkerController, Frontends: opts.Frontends, CacheManager: opts.CacheManager, SessionManager: opts.SessionManager,
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/buildkitcontroller.go
CacheResolvers: opts.UpstreamCacheImporters, Entitlements: opts.Entitlements, }) if err != nil { return nil, fmt.Errorf("failed to create solver: %w", err) } genericSolver := solver.NewSolver(solver.SolverOpt{ ResolveOpFunc: func(vtx solver.Vertex, builder solver.Builder) (solver.Op, error) { return w.ResolveOp(vtx, llbSolver.Bridge(builder), opts.SessionManager) }, DefaultCache: opts.CacheManager, }) e := &BuildkitController{ BuildkitControllerOpts: opts, llbSolver: llbSolver, genericSolver: genericSolver, cacheManager: opts.CacheManager, worker: w, servers: make(map[string]*DaggerServer), perServerMu: locker.New(), } for _, entitlementStr := range opts.Entitlements { if entitlementStr == string(entitlements.EntitlementSecurityInsecure) { e.privilegedExecEnabled = true } } e.throttledGC = throttle.After(time.Minute, e.gc) defer func() { time.AfterFunc(time.Second, e.throttledGC) }()
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/buildkitcontroller.go
return e, nil } func (e *BuildkitController) LogMetrics(l *logrus.Entry) *logrus.Entry { e.serverMu.RLock() defer e.serverMu.RUnlock() l = l.WithField("dagger-server-count", len(e.servers)) for _, s := range e.servers { l = s.LogMetrics(l) } return l } func (e *BuildkitController) Session(stream controlapi.Control_SessionServer) (rerr error) { defer func() { if err := recover(); err != nil { bklog.G(context.Background()).WithError(fmt.Errorf("%v", err)).Errorf("panic in session call") debug.PrintStack() rerr = fmt.Errorf("panic in session call, please report a bug: %v %s", err, string(debug.Stack())) } }() ctx, cancel := context.WithCancel(stream.Context()) defer cancel() opts, err := engine.ClientMetadataFromContext(ctx) if err != nil { bklog.G(ctx).WithError(err).Errorf("failed to get client metadata for session call") return fmt.Errorf("failed to get client metadata for session call: %w", err) } ctx = bklog.WithLogger(ctx, bklog.G(ctx). WithField("client_id", opts.ClientID). WithField("client_hostname", opts.ClientHostname).
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/buildkitcontroller.go
WithField("client_call_digest", opts.ModuleCallerDigest). WithField("server_id", opts.ServerID)) bklog.G(ctx).WithField("register_client", opts.RegisterClient).Debug("handling session call") defer func() { if rerr != nil { bklog.G(ctx).WithError(rerr).Errorf("session call failed") } else { bklog.G(ctx).Debugf("session call done") } }() conn, closeCh, hijackmd := grpchijack.Hijack(stream) go func() { <-closeCh cancel() }() if !opts.RegisterClient { e.serverMu.RLock() srv, ok := e.servers[opts.ServerID] e.serverMu.RUnlock() if !ok { return fmt.Errorf("server %q not found", opts.ServerID) } err := srv.bkClient.VerifyClient(opts.ClientID, opts.ClientSecretToken) if err != nil { return fmt.Errorf("failed to verify client: %w", err) } bklog.G(ctx).Debugf("forwarding client to server") err = srv.ServeClientConn(ctx, opts, conn)
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/buildkitcontroller.go
if errors.Is(err, io.ErrClosedPipe) { return nil } return fmt.Errorf("serve clientConn: %w", err) } bklog.G(ctx).Debugf("registering client") eg, egctx := errgroup.WithContext(ctx) eg.Go(func() error { bklog.G(ctx).Debug("session manager handling conn") err := e.SessionManager.HandleConn(egctx, conn, hijackmd) bklog.G(ctx).WithError(err).Debug("session manager handle conn done") if err != nil { return fmt.Errorf("handleConn: %w", err) } return nil }) e.perServerMu.Lock(opts.ServerID) e.serverMu.RLock() srv, ok := e.servers[opts.ServerID] e.serverMu.RUnlock() if !ok { bklog.G(ctx).Debugf("initializing new server") getSessionCtx, getSessionCancel := context.WithTimeout(ctx, 10*time.Second) defer getSessionCancel() caller, err := e.SessionManager.Get(getSessionCtx, opts.ClientID, false) if err != nil {
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/buildkitcontroller.go
e.perServerMu.Unlock(opts.ServerID) return fmt.Errorf("get session: %w", err) } bklog.G(ctx).Debugf("connected new server session") secretStore := core.NewSecretStore() authProvider := auth.NewRegistryAuthProvider() var cacheImporterCfgs []bkgw.CacheOptionsEntry for _, cacheImportCfg := range opts.UpstreamCacheImportConfig { _, ok := e.UpstreamCacheImporters[cacheImportCfg.Type] if !ok { e.perServerMu.Unlock(opts.ServerID) return fmt.Errorf("unknown cache importer type %q", cacheImportCfg.Type) } cacheImporterCfgs = append(cacheImporterCfgs, bkgw.CacheOptionsEntry{ Type: cacheImportCfg.Type, Attrs: cacheImportCfg.Attrs, }) } progSockPath := fmt.Sprintf("/run/dagger/server-progrock-%s.sock", identity.NewID()) bkClient, err := buildkit.NewClient(ctx, buildkit.Opts{ Worker: e.worker, SessionManager: e.SessionManager, LLBSolver: e.llbSolver, GenericSolver: e.genericSolver, SecretStore: secretStore, AuthProvider: authProvider, PrivilegedExecEnabled: e.privilegedExecEnabled, UpstreamCacheImports: cacheImporterCfgs,
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/buildkitcontroller.go
ProgSockPath: progSockPath, MainClientCaller: caller, MainClientCallerID: opts.ClientID, DNSConfig: e.DNSConfig, Frontends: e.Frontends, }) if err != nil { e.perServerMu.Unlock(opts.ServerID) return fmt.Errorf("new Buildkit client: %w", err) } bklog.G(ctx).Debugf("initialized new server buildkit client") labels := opts.Labels labels = append(labels, pipeline.EngineLabel(e.EngineName)) labels = append(labels, pipeline.LoadServerLabels(engine.Version, runtime.GOOS, runtime.GOARCH, e.cacheManager.ID() != cache.LocalCacheID)...) srv, err = NewDaggerServer(ctx, bkClient, e.worker, caller, opts.ServerID, secretStore, authProvider, labels, opts.CloudToken, opts.DoNotTrack) if err != nil { e.perServerMu.Unlock(opts.ServerID) return fmt.Errorf("new Dagger server: %w", err) } e.serverMu.Lock() e.servers[opts.ServerID] = srv e.serverMu.Unlock() bklog.G(ctx).Debugf("initialized new server") defer func() { bklog.G(ctx).Debug("removing server") e.serverMu.Lock() delete(e.servers, opts.ServerID) e.serverMu.Unlock() srv.Close()
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/buildkitcontroller.go
if err := bkClient.Close(); err != nil { bklog.G(ctx).WithError(err).Errorf("failed to close buildkit client for server %s", opts.ServerID) } bklog.G(ctx).Debug("closed buildkit client") time.AfterFunc(time.Second, e.throttledGC) bklog.G(ctx).Debug("server removed") }() } e.perServerMu.Unlock(opts.ServerID) err = srv.bkClient.RegisterClient(opts.ClientID, opts.ClientHostname, opts.ClientSecretToken) if err != nil { return fmt.Errorf("failed to register client: %w", err) } eg.Go(func() error { bklog.G(ctx).Trace("waiting for server") err := srv.Wait(egctx) bklog.G(ctx).WithError(err).Trace("server done") if err != nil { return fmt.Errorf("srv.Wait: %w", err) } return nil }) err = eg.Wait() if errors.Is(err, context.Canceled) { err = nil } if err != nil { return fmt.Errorf("wait: %w", err) } return nil
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/buildkitcontroller.go
} func (e *BuildkitController) Solve(ctx context.Context, req *controlapi.SolveRequest) (*controlapi.SolveResponse, error) { opts, err := engine.ClientMetadataFromContext(ctx) if err != nil { return nil, err } ctx = bklog.WithLogger(ctx, bklog.G(ctx). WithField("client_id", opts.ClientID). WithField("client_hostname", opts.ClientHostname). WithField("server_id", opts.ServerID)) e.serverMu.RLock() srv, ok := e.servers[opts.ServerID] e.serverMu.RUnlock() if !ok { return nil, fmt.Errorf("unknown server id %q", opts.ServerID) } err = srv.bkClient.VerifyClient(opts.ClientID, opts.ClientSecretToken) if err != nil { return nil, fmt.Errorf("failed to register client: %w", err) } cacheExporterFuncs := make([]buildkit.ResolveCacheExporterFunc, len(req.Cache.Exports)) for i, cacheExportCfg := range req.Cache.Exports { cacheExportCfg := cacheExportCfg exporterFunc, ok := e.UpstreamCacheExporters[cacheExportCfg.Type] if !ok { return nil, fmt.Errorf("unknown cache exporter type %q", cacheExportCfg.Type) } cacheExporterFuncs[i] = func(ctx context.Context, sessionGroup session.Group) (remotecache.Exporter, error) { return exporterFunc(ctx, sessionGroup, cacheExportCfg.Attrs) }
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/buildkitcontroller.go
} if len(cacheExporterFuncs) > 0 { bklog.G(ctx).Debugf("running cache export for client %s", opts.ClientID) err := srv.bkClient.UpstreamCacheExport(ctx, cacheExporterFuncs) if err != nil { bklog.G(ctx).WithError(err).Errorf("error running cache export for client %s", opts.ClientID) return &controlapi.SolveResponse{}, err } bklog.G(ctx).Debugf("done running cache export for client %s", opts.ClientID) } return &controlapi.SolveResponse{}, nil } func (e *BuildkitController) DiskUsage(ctx context.Context, r *controlapi.DiskUsageRequest) (*controlapi.DiskUsageResponse, error) { resp := &controlapi.DiskUsageResponse{} du, err := e.worker.DiskUsage(ctx, bkclient.DiskUsageInfo{ Filter: r.Filter, }) if err != nil { return nil, err } for _, r := range du { resp.Record = append(resp.Record, &controlapi.UsageRecord{ ID: r.ID, Mutable: r.Mutable, InUse: r.InUse, Size_: r.Size, Parents: r.Parents, UsageCount: int64(r.UsageCount), Description: r.Description,
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/buildkitcontroller.go
CreatedAt: r.CreatedAt, LastUsedAt: r.LastUsedAt, RecordType: string(r.RecordType), Shared: r.Shared, }) } return resp, nil } func (e *BuildkitController) Prune(req *controlapi.PruneRequest, stream controlapi.Control_PruneServer) error { eg, ctx := errgroup.WithContext(stream.Context()) e.serverMu.RLock() cancelLeases := len(e.servers) == 0 e.serverMu.RUnlock() if cancelLeases { imageutil.CancelCacheLeases() } didPrune := false defer func() { if didPrune { if e, ok := e.cacheManager.(interface { ReleaseUnreferenced(context.Context) error }); ok { if err := e.ReleaseUnreferenced(ctx); err != nil { bklog.G(ctx).Errorf("failed to release cache metadata: %+v", err) } } } }() ch := make(chan bkclient.UsageInfo, 32) eg.Go(func() error {
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/buildkitcontroller.go
defer close(ch) return e.worker.Prune(ctx, ch, bkclient.PruneInfo{ Filter: req.Filter, All: req.All, KeepDuration: time.Duration(req.KeepDuration), KeepBytes: req.KeepBytes, }) }) eg.Go(func() error { defer func() { for range ch { } }() for r := range ch { didPrune = true if err := stream.Send(&controlapi.UsageRecord{ ID: r.ID, Mutable: r.Mutable, InUse: r.InUse, Size_: r.Size, Parents: r.Parents, UsageCount: int64(r.UsageCount), Description: r.Description, CreatedAt: r.CreatedAt, LastUsedAt: r.LastUsedAt, RecordType: string(r.RecordType), Shared: r.Shared, }); err != nil { return err
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/buildkitcontroller.go
} } return nil }) return eg.Wait() } func (e *BuildkitController) Info(ctx context.Context, r *controlapi.InfoRequest) (*controlapi.InfoResponse, error) { return &controlapi.InfoResponse{ BuildkitVersion: &apitypes.BuildkitVersion{ Package: engine.Package, Version: engine.Version, Revision: e.EngineName, }, }, nil } func (e *BuildkitController) ListWorkers(ctx context.Context, r *controlapi.ListWorkersRequest) (*controlapi.ListWorkersResponse, error) { resp := &controlapi.ListWorkersResponse{ Record: []*apitypes.WorkerRecord{{ ID: e.worker.ID(), Labels: e.worker.Labels(), Platforms: pb.PlatformsFromSpec(e.worker.Platforms(true)), }}, } return resp, nil } func (e *BuildkitController) Export(ctx context.Context, req *tracev1.ExportTraceServiceRequest) (*tracev1.ExportTraceServiceResponse, error) { if e.TraceCollector == nil { return nil, status.Errorf(codes.Unavailable, "trace collector not configured") } err := e.TraceCollector.ExportSpans(ctx, transform.Spans(req.GetResourceSpans()))
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/buildkitcontroller.go
if err != nil { return nil, err } return &tracev1.ExportTraceServiceResponse{}, nil } func (e *BuildkitController) Register(server *grpc.Server) { controlapi.RegisterControlServer(server, e) tracev1.RegisterTraceServiceServer(server, e) } func (e *BuildkitController) Close() error { err := e.WorkerController.Close() e.serverMu.Lock() servers := e.servers e.servers = nil e.serverMu.Unlock() for _, s := range servers { s.Close() } return err } func (e *BuildkitController) gc() { e.gcmu.Lock() defer e.gcmu.Unlock() ch := make(chan bkclient.UsageInfo) eg, ctx := errgroup.WithContext(context.TODO()) var size int64 eg.Go(func() error { for ui := range ch {
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/buildkitcontroller.go
size += ui.Size } return nil }) eg.Go(func() error { defer close(ch) if policy := e.worker.GCPolicy(); len(policy) > 0 { return e.worker.Prune(ctx, ch, policy...) } return nil }) err := eg.Wait() if err != nil { bklog.G(ctx).Errorf("gc error: %+v", err) } if size > 0 { bklog.G(ctx).Debugf("gc cleaned up %d bytes", size) } } func (e *BuildkitController) Status(req *controlapi.StatusRequest, stream controlapi.Control_StatusServer) error { return fmt.Errorf("status not implemented") } func (e *BuildkitController) ListenBuildHistory(req *controlapi.BuildHistoryRequest, srv controlapi.Control_ListenBuildHistoryServer) error { return fmt.Errorf("listen build history not implemented") } func (e *BuildkitController) UpdateBuildHistory(ctx context.Context, req *controlapi.UpdateBuildHistoryRequest) (*controlapi.UpdateBuildHistoryResponse, error) { return nil, fmt.Errorf("update build history not implemented") }
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/server.go
package server import ( "bytes" "context" "errors" "fmt" "io" "net" "net/http" "os" "sync" "time" "github.com/dagger/dagger/analytics" "github.com/dagger/dagger/auth" "github.com/dagger/dagger/core" "github.com/dagger/dagger/core/pipeline" "github.com/dagger/dagger/core/schema" "github.com/dagger/dagger/engine" "github.com/dagger/dagger/engine/buildkit" bksession "github.com/moby/buildkit/session" "github.com/moby/buildkit/util/bklog" bkworker "github.com/moby/buildkit/worker" "github.com/sirupsen/logrus" "github.com/vito/progrock" ) type DaggerServer struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/server.go
serverID string bkClient *buildkit.Client worker bkworker.Worker schema *schema.APIServer recorder *progrock.Recorder analytics analytics.Tracker progCleanup func() error doneCh chan struct{}
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/server.go
closeOnce sync.Once connectedClients int clientMu sync.RWMutex } func NewDaggerServer( ctx context.Context, bkClient *buildkit.Client, worker bkworker.Worker, caller bksession.Caller, serverID string, secretStore *core.SecretStore, authProvider *auth.RegistryAuthProvider, rootLabels []pipeline.Label, cloudToken string, doNotTrack bool, ) (*DaggerServer, error) { srv := &DaggerServer{ serverID: serverID, bkClient: bkClient, worker: worker, analytics: analytics.New(analytics.Config{ DoNotTrack: doNotTrack || analytics.DoNotTrack(), Labels: rootLabels, CloudToken: cloudToken, }), doneCh: make(chan struct{}, 1),
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/server.go
} clientConn := caller.Conn() progClient := progrock.NewProgressServiceClient(clientConn) progUpdates, err := progClient.WriteUpdates(ctx) if err != nil { return nil, err } progWriter, progCleanup, err := buildkit.ProgrockForwarder(bkClient.ProgSockPath, progrock.MultiWriter{ progrock.NewRPCWriter(clientConn, progUpdates), buildkit.ProgrockLogrusWriter{}, }) if err != nil { return nil, err } srv.progCleanup = progCleanup progrockLabels := []*progrock.Label{} for _, label := range rootLabels { progrockLabels = append(progrockLabels, &progrock.Label{ Name: label.Name, Value: label.Value, }) } srv.recorder = progrock.NewRecorder(progWriter, progrock.WithLabels(progrockLabels...))
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/server.go
bkClient.WriteStatusesTo(context.Background(), srv.recorder) apiSchema, err := schema.New(ctx, schema.InitializeArgs{ BuildkitClient: srv.bkClient, Platform: srv.worker.Platforms(true)[0], ProgSockPath: bkClient.ProgSockPath, OCIStore: srv.worker.ContentStore(), LeaseManager: srv.worker.LeaseManager(), Secrets: secretStore, Auth: authProvider, }) if err != nil { return nil, err } srv.schema = apiSchema return srv, nil } func (srv *DaggerServer) LogMetrics(l *logrus.Entry) *logrus.Entry { srv.clientMu.RLock() defer srv.clientMu.RUnlock() return l.WithField(fmt.Sprintf("server-%s-client-count", srv.serverID), srv.connectedClients) } func (srv *DaggerServer) Close() { defer srv.closeOnce.Do(func() { close(srv.doneCh) }) srv.recorder.Complete()
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/server.go
srv.recorder.Close() srv.progCleanup() srv.analytics.Close() } func (srv *DaggerServer) Wait(ctx context.Context) error { select { case <-ctx.Done(): return ctx.Err() case <-srv.doneCh: return nil } } func (srv *DaggerServer) ServeClientConn( ctx context.Context, clientMetadata *engine.ClientMetadata, conn net.Conn, ) error { bklog.G(ctx).Trace("serve client conn") defer bklog.G(ctx).Trace("done serving client conn") srv.clientMu.Lock() srv.connectedClients++ defer func() { srv.clientMu.Lock() srv.connectedClients-- srv.clientMu.Unlock() }() srv.clientMu.Unlock() conn = newLogicalDeadlineConn(nopCloserConn{conn}) l := &singleConnListener{conn: conn, closeCh: make(chan struct{})}
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/server.go
go func() { <-ctx.Done() l.Close() }() handler, handlerDone, err := srv.HTTPHandlerForClient(clientMetadata, conn, bklog.G(ctx)) if err != nil { return fmt.Errorf("failed to create http handler: %w", err) } defer func() { <-handlerDone bklog.G(ctx).Trace("handler done") }() httpSrv := http.Server{ Handler: handler, ReadHeaderTimeout: 30 * time.Second, } defer httpSrv.Close() return httpSrv.Serve(l) } func (srv *DaggerServer) HTTPHandlerForClient(clientMetadata *engine.ClientMetadata, conn net.Conn, lg *logrus.Entry) (http.Handler, <-chan struct{}, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/server.go
doneCh := make(chan struct{}) return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { defer close(doneCh) req = req.WithContext(bklog.WithLogger(req.Context(), lg)) bklog.G(req.Context()).Debugf("http handler for client conn to path %s", req.URL.Path) defer bklog.G(req.Context()).Debugf("http handler for client conn done: %s", clientMetadata.ClientID) req = req.WithContext(progrock.ToContext(req.Context(), srv.recorder)) req = req.WithContext(engine.ContextWithClientMetadata(req.Context(), clientMetadata)) req = req.WithContext(analytics.WithContext(req.Context(), srv.analytics)) srv.schema.ServeHTTP(w, req) }), doneCh, nil } type singleConnListener struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/server.go
conn net.Conn l sync.Mutex closeCh chan struct{} closeOnce sync.Once } func (l *singleConnListener) Accept() (net.Conn, error) { l.l.Lock() if l.conn == nil { l.l.Unlock() <-l.closeCh return nil, io.ErrClosedPipe } defer l.l.Unlock() c := l.conn l.conn = nil return c, nil } func (l *singleConnListener) Addr() net.Addr { return nil } func (l *singleConnListener) Close() error { l.closeOnce.Do(func() { close(l.closeCh) }) return nil } type nopCloserConn struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/server.go
net.Conn } func (nopCloserConn) Close() error { return nil } type withDeadlineConn struct { conn net.Conn readDeadline time.Time readers []func() readBuf *bytes.Buffer readEOF bool readCond *sync.Cond writeDeadline time.Time writers []func() writersL sync.Mutex } func newLogicalDeadlineConn(inner net.Conn) net.Conn {
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/server.go
c := &withDeadlineConn{ conn: inner, readBuf: new(bytes.Buffer), readCond: sync.NewCond(new(sync.Mutex)), } go func() { for { buf := make([]byte, 32*1024) n, err := inner.Read(buf) if err != nil { c.readCond.L.Lock() c.readEOF = true c.readCond.L.Unlock() c.readCond.Broadcast() return } c.readCond.L.Lock() c.readBuf.Write(buf[0:n]) c.readCond.Broadcast() c.readCond.L.Unlock() }
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/server.go
}() return c } func (c *withDeadlineConn) Read(b []byte) (n int, err error) { c.readCond.L.Lock() if c.readEOF { c.readCond.L.Unlock() return 0, io.EOF } ctx, cancel := context.WithCancel(context.Background()) defer cancel() if !c.readDeadline.IsZero() { if time.Now().After(c.readDeadline) { c.readCond.L.Unlock() return 0, os.ErrDeadlineExceeded } go func() { dt := time.Until(c.readDeadline) if dt > 0 { time.Sleep(dt) } cancel() }() } c.readers = append(c.readers, cancel) c.readCond.L.Unlock() read := make(chan struct{})
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/server.go
var rN int var rerr error go func() { defer close(read) c.readCond.L.Lock() defer c.readCond.L.Unlock() for ctx.Err() == nil { if c.readEOF { rerr = io.EOF break } n, _ := c.readBuf.Read(b) if n > 0 { rN = n break } c.readCond.Wait() } }() select { case <-read: return rN, rerr case <-ctx.Done():
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/server.go
return 0, os.ErrDeadlineExceeded } } func (c *withDeadlineConn) Write(b []byte) (n int, err error) { c.writersL.Lock() ctx, cancel := context.WithCancel(context.Background()) defer cancel() if !c.writeDeadline.IsZero() { if time.Now().After(c.writeDeadline) { c.writersL.Unlock() return 0, os.ErrDeadlineExceeded } go func() { dt := time.Until(c.writeDeadline) if dt > 0 { time.Sleep(dt) } cancel() }() } c.writers = append(c.writers, cancel) c.writersL.Unlock() write := make(chan int, 1) go func() { n, err = c.conn.Write(b) write <- 0 }()
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/server.go
select { case <-write: return n, err case <-ctx.Done(): return 0, os.ErrDeadlineExceeded } } func (c *withDeadlineConn) Close() error { return c.conn.Close() } func (c *withDeadlineConn) LocalAddr() net.Addr { return c.conn.LocalAddr() } func (c *withDeadlineConn) RemoteAddr() net.Addr { return c.conn.RemoteAddr() } func (c *withDeadlineConn) SetDeadline(t time.Time) error { return errors.Join( c.SetReadDeadline(t), c.SetWriteDeadline(t), ) } func (c *withDeadlineConn) SetReadDeadline(t time.Time) error { c.readCond.L.Lock() c.readDeadline = t readers := c.readers c.readCond.L.Unlock() if len(readers) > 0 && !t.IsZero() { go func() {
closed
dagger/dagger
https://github.com/dagger/dagger
6,719
Very high memory usage in dagger engine
I noticed that on `main` when running `go test -run=TestModule ...` the engine ends up using over 6GB of RSS at times. By eye, it seems like it particularly spikes during `TestModuleLotsOfFunctions` (but did not fully confirm yet). `pprof` is showing: ``` File: dagger-engine Type: inuse_space Time: Feb 22, 2024 at 10:18am (PST) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1811.45MB, 71.51% of 2533.09MB total Dropped 846 nodes (cum <= 12.67MB) Showing top 10 nodes out of 239 flat flat% sum% cum cum% 622.26MB 24.57% 24.57% 622.26MB 24.57% github.com/moby/buildkit/solver/pb.(*FileActionMkFile).Unmarshal 605.22MB 23.89% 48.46% 605.22MB 23.89% github.com/moby/buildkit/solver/pb.(*Op).Marshal 104.69MB 4.13% 52.59% 104.69MB 4.13% google.golang.org/grpc/internal/transport.newBufWriter 103.08MB 4.07% 56.66% 103.08MB 4.07% encoding/json.(*decodeState).literalStore 90.83MB 3.59% 60.25% 201.88MB 7.97% github.com/dagger/dagger/core.(*ModDeps).lazilyLoadSchema 90.26MB 3.56% 63.81% 90.26MB 3.56% bufio.NewReaderSize 75.57MB 2.98% 66.79% 75.57MB 2.98% google.golang.org/protobuf/internal/impl.consumeStringValidateUTF8 51.02MB 2.01% 68.81% 69.52MB 2.74% google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders 34.51MB 1.36% 70.17% 34.51MB 1.36% github.com/moby/buildkit/client/llb.mergeMetadata 34.02MB 1.34% 71.51% 34.02MB 1.34% github.com/dagger/dagger/dagql.Class[go.shape.*uint8].Install ``` The top memory users seem pretty consistent across two runs. I can't help but wonder to what extent the goroutine leak as mentioned by @jedevc could be related: https://github.com/dagger/dagger/pull/6597. I.e. the goroutine leak is resulting in memory allocated by the above still be reachable. Just a superficial connection in that goroutine leaks are a very common culprit of memory leaks, could be red herring. Also wondering if the recent changes to make more [heavy use of caching `OpDAG` modifications](https://github.com/dagger/dagger/pull/6505) could be related, just in that it could be connected to the heavy usage of `Op.Marshal` in the pprof output. * Can test by going back before that commit and seeing if the memory usage was any different.
https://github.com/dagger/dagger/issues/6719
https://github.com/dagger/dagger/pull/6760
f71928d6e4baef0735e06afacdf2772880bf1536
a0b622addceef9308b75c928935394c976c4872b
"2024-02-22T19:02:08Z"
go
"2024-02-27T19:34:42Z"
engine/server/server.go
dt := time.Until(c.readDeadline) if dt > 0 { time.Sleep(dt) } for _, cancel := range readers { cancel() } }() } return nil } func (c *withDeadlineConn) SetWriteDeadline(t time.Time) error { c.writersL.Lock() c.writeDeadline = t writers := c.writers c.writersL.Unlock() if len(writers) > 0 && !t.IsZero() { go func() { dt := time.Until(c.writeDeadline) if dt > 0 { time.Sleep(dt) } for _, cancel := range writers { cancel() } }() } return nil }
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/flags.go
package main import ( "bytes" "context" "crypto/sha256" "encoding/csv" "encoding/hex" "fmt" "io" "net" "net/url" "os" "os/exec" "path/filepath" "reflect" "strconv" "strings" "dagger.io/dagger" "github.com/moby/buildkit/util/gitutil" "github.com/spf13/pflag" ) func GetCustomFlagValue(name string) DaggerValue {
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/flags.go
switch name { case Container: return &containerValue{} case Directory: return &directoryValue{} case File: return &fileValue{} case Secret: return &secretValue{} case Service: return &serviceValue{} case PortForward: return &portForwardValue{} case CacheVolume: return &cacheVolumeValue{} } return nil } func GetCustomFlagValueSlice(name string) DaggerValue {
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/flags.go
switch name { case Container: return &sliceValue[*containerValue]{} case Directory: return &sliceValue[*directoryValue]{} case File: return &sliceValue[*fileValue]{} case Secret: return &sliceValue[*secretValue]{} case Service: return &sliceValue[*serviceValue]{} case PortForward: return &sliceValue[*portForwardValue]{} case CacheVolume: return &sliceValue[*cacheVolumeValue]{} } return nil } type DaggerValue interface { pflag.Value Get(context.Context, *dagger.Client) (any, error) } type sliceValue[T DaggerValue] struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/flags.go
value []T } func (v *sliceValue[T]) Type() string { var t T return t.Type() } func (v *sliceValue[T]) String() string { ss := []string{} for _, v := range v.value { ss = append(ss, v.String()) } out, _ := writeAsCSV(ss) return "[" + out + "]" } func (v *sliceValue[T]) Get(ctx context.Context, c *dagger.Client) (any, error) { out := make([]any, len(v.value)) for i, v := range v.value { outV, err := v.Get(ctx, c) if err != nil { return nil, err
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/flags.go
} out[i] = outV } return out, nil } func (v *sliceValue[T]) Set(s string) error { rmQuote := strings.NewReplacer(`"`, "", `'`, "", "`", "") ss, err := readAsCSV(rmQuote.Replace(s)) if err != nil && err != io.EOF { return err } out := make([]T, 0, len(ss)) for _, s := range ss { var v T if typ := reflect.TypeOf(v); typ.Kind() == reflect.Ptr { v = reflect.New(typ.Elem()).Interface().(T) } if err := v.Set(strings.TrimSpace(s)); err != nil { return err } out = append(out, v) } v.value = append(v.value, out...) return nil } type containerValue struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/flags.go
address string } func (v *containerValue) Type() string { return Container } func (v *containerValue) Set(s string) error { if s == "" { return fmt.Errorf("container address cannot be empty") } v.address = s return nil } func (v *containerValue) String() string { return v.address } func (v *containerValue) Get(_ context.Context, c *dagger.Client) (any, error) { if v.address == "" { return nil, fmt.Errorf("container address cannot be empty") } return c.Container().From(v.String()), nil } type directoryValue struct {
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/flags.go
address string } func (v *directoryValue) Type() string { return Directory } func (v *directoryValue) Set(s string) error { if s == "" { return fmt.Errorf("directory address cannot be empty") } v.address = s return nil } func (v *directoryValue) String() string { return v.address } func (v *directoryValue) Get(_ context.Context, dag *dagger.Client) (any, error) {
closed
dagger/dagger
https://github.com/dagger/dagger
6,725
Support passing modules as arguments in the CLI
Modules can accept other modules as arguments to functions. Use cases: 1. SDKs implemented as modules do this already by accepting `ModuleSource` as an arg 2. Support for running tests of modules could use this: https://github.com/dagger/dagger/issues/6724 3. Support for re-executing modules in specialized hosts (i.e. run my module on a "gpu-as-a-service" platform) 4. Combined with support for interfaces, you could pass a module as an implementation of an interface argument (if it matches) * @vito mentioned one use case specifically around using this to construct a dev env that is defined across multiple modules and could be dynamically composed into one (IIUC, correct if I misunderstood) However, it's not yet possible to do this from the CLI with `dagger call`, which greatly limits its utility. We could likely just re-use the syntax we use for `-m`, e.g.: * `dagger call go-test --module github.com/my-org/my-repo/my-mod`, where `--module` is an argument of type either `ModuleSource`, `Module` or an interface that the module must implement. That would in theory be extremely straightforward to implement while also unlocking all sorts of very interesting use cases
https://github.com/dagger/dagger/issues/6725
https://github.com/dagger/dagger/pull/6761
c5bf6978ba169abbc5cef54b3d7cd829f141d792
e02ff3d2b50665275deb52902abc46ac0f6f138a
"2024-02-23T18:56:08Z"
go
"2024-02-27T22:55:04Z"
cmd/dagger/flags.go
if v.String() == "" { return nil, fmt.Errorf("directory address cannot be empty") } parsedGit, err := parseGit(v.String()) if err == nil { gitOpts := dagger.GitOpts{ KeepGitDir: true, } if authSock, ok := os.LookupEnv("SSH_AUTH_SOCK"); ok { gitOpts.SSHAuthSocket = dag.Host().UnixSocket(authSock) } gitDir := dag.Git(parsedGit.Remote, gitOpts).Branch(parsedGit.Fragment.Ref).Tree() if subdir := parsedGit.Fragment.Subdir; subdir != "" { gitDir = gitDir.Directory(subdir) } return gitDir, nil } vStr := v.String() vStr = strings.TrimPrefix(vStr, "file:") if !filepath.IsAbs(vStr) { vStr, err = filepath.Abs(vStr) if err != nil { return nil, fmt.Errorf("failed to resolve absolute path: %w", err) } } return dag.Host().Directory(vStr), nil } func parseGit(urlStr string) (*gitutil.GitURL, error) {