Skip to content

SIGSEGV in dagger-engine on linux/amd64 after upgrade to go1.24 #9759

Closed

Description

@jedevc

I know me and @rajatjindal have started seeing this in v0.16.2, but @gmile in #8830 has also seen this.

Repeatedly running dagger function succeeds most of the times, but occasionally would fail with either of these two errors:

✘ load module 1.3s
! failed to get configured module: Post "http://dagger/query": unexpected EOF
│ ✘ finding module configuration 1.3s
│ ! Post "http://dagger/query": unexpected EOF
│ │ ∅ moduleSource(refString: "."): ModuleSource! 2.5s
✘ load module 1.9s
! failed to get configured module: Post "http://dagger/query": command [docker exec -i dagger-engine-v0.16.2 buildctl dial-stdio] has exited with exit status 137, make sure the URL is valid, and Docker 18.09 or later is installed on the remote host: stderr=
│ ✘ finding module configuration 1.9s
│ ! Post "http://dagger/query": command [docker exec -i dagger-engine-v0.16.2 buildctl dial-stdio] has exited with exit status 137, make sure the URL is valid, and Docker 18.09 or later is installed on the remote host: stderr=
│ │ ∅ moduleSource(refString: "."): ModuleSource! 3.1s
Error: failed to get configured module: Post "http://dagger/query": command [docker exec -i dagger-engine-v0.16.2 buildctl dial-stdio] has exited with exit status 137, make sure the URL is valid, and Docker 18.09 or later is installed on the remote host: stderr=

Essentially, we seem to get a full on SIGSEGV, on my machine I can get a coredump:

❯ sudo coredumpctl info
           PID: 2320 (dagger-engine)
           UID: 0 (root)
           GID: 0 (root)
        Signal: 11 (SEGV)
     Timestamp: Mon 2025-03-03 13:02:21 GMT (20min ago)
  Command Line: /usr/local/bin/dagger-engine --config /etc/dagger/engine.toml --debug
    Executable: /usr/local/bin/dagger-engine
 Control Group: /system.slice/docker-78c867c4f854049c676bbc66e21ab369d526987de2d90ddb18b00e70804b4015.scope/init
          Unit: docker-78c867c4f854049c676bbc66e21ab369d526987de2d90ddb18b00e70804b4015.scope
         Slice: system.slice
       Boot ID: f564ae99bbda49528f6444c690454a84
    Machine ID: 03592b6b1309487b920cb5fcb6c06e31
      Hostname: 78c867c4f854
       Storage: /var/lib/systemd/coredump/core.dagger-engine.0.f564ae99bbda49528f6444c690454a84.2320.1741006941000000.zst (present)
  Size on Disk: 49.8M
       Message: Process 2320 (dagger-engine) of user 0 dumped core.
                
                Stack trace of thread 2648:
                #0  0x0000000000418f78 n/a (n/a + 0x0)
                #1  0x00000000004779d9 n/a (n/a + 0x0)
                #2  0x000000000047cc49 n/a (n/a + 0x0)
                #3  0x00000000004745b6 n/a (n/a + 0x0)
                #4  0x00000000004483c5 n/a (n/a + 0x0)
                #5  0x000000000044807f n/a (n/a + 0x0)
                ELF object binary architecture: AMD x86-64

Reading the coredump, I don't get anything particularly informative:

(dlv) bt
0  0x0000000000418f78 in runtime.mallocgcSmallNoscan
   at /usr/lib/go/src/runtime/malloc.go:1280
1  0x00000000004779d9 in runtime.mallocgc
   at :0
2  0x000000000047cc49 in runtime.growslice
   at :0
3  0x00000000004745b6 in runtime.vgetrandomPutState
   at :0
4  0x00000000004483c5 in runtime.mexit
   at :0
5  0x000000000044807f in runtime.mstart0
   at :0
   error: error while reading spliced memory at 0x8: EOF
(truncated)

(dlv) disassemble 
Sending output to pager...
TEXT runtime.mallocgcSmallNoscan(SB) /usr/lib/go/src/runtime/malloc.go
	malloc.go:1254	0x418ea0	493b6610		cmp rsp, qword ptr [r14+0x10]
	malloc.go:1254	0x418ea4	0f86d0020000		jbe 0x41917a
	malloc.go:1254	0x418eaa	55			push rbp
	malloc.go:1254	0x418eab	4889e5			mov rbp, rsp
	malloc.go:1254	0x418eae	4883ec48		sub rsp, 0x48

It looks like something memory-related in the go runtime is crashing, probably caused by our PR here #9673.

I've also seen this reported by the moby folks in moby/moby#49513 (comment) (potentially we both consume some logic that's good at getting this to happen?)

Activity

  1. added
    kind/bug
    area/engine
    on Mar 3, 2025
  2. TomChv commented on Mar 3, 2025

    @TomChv
    Member

    I keep seing this problem too, I can't regenerate clients or executes dagger call, ./hack/dev works though :/

    Error: Post "http://dagger/query": command [docker exec -i dagger-engine-v0.16.2 buildctl dial-stdio] has exited with exit status 137, make sure the URL is valid, and Docker 18.09 or later is installed on the remote host: stderr=
    
  3. jedevc commented on Mar 5, 2025

    @jedevc
    ContributorAuthor

    Doesn't look like 1.24.1 has a fix - still seeing this on a build from main - it actually seems significantly worse 😢

  4. reopened this on Mar 5, 2025
  5. thaJeztah commented on Mar 6, 2025

    @thaJeztah

    👋 Hi! @jedevc these segfaults are in the docker engine, or dagger? I saw you discovered moby/moby#49513 - Still hoping someone is able to construct a more limited reproducer (other than "build docker and try a bunch of pulls"), and/or git-bisect Go to find the regression point 😞 (seeing your ticket linked made me hopeful for possibly dagger codebase to be more lightweight / straightforward to lend itself for that).

  6. reopened this on Mar 6, 2025
  7. jedevc commented on Mar 6, 2025

    @jedevc
    ContributorAuthor

    👋 long time no see! 😄

    Yaah, this isn't a docker segfault, at least on my machine - I'm still using docker 27.5.1 built with go1.23.5. The timeline matches up almost exactly for us with when we bumped to go1.24 in dagger - so it seems reasonable to suspect this too.

    I'm kinda struggling to understand what hits this, it seems to occur in logs next to lots of git clones. I haven't really dived in deep, hopefully will find some time soon to do so!

    seeing your ticket linked made me hopeful for possibly dagger codebase to be more lightweight / straightforward to lend itself for that

    😆 mmm, given we pull all of buildkit in and add lots of logic on top, I'm not entirely sure it'll be entirely straightforward 😢 That said, maybe we'll also see it after merging moby/buildkit#5814.

  8. changed the title [-]SIGSEGV in dagger-engine[/-] [+]SIGSEGV in dagger-engine after upgrade to go1.24[/+] on Mar 6, 2025
  9. skycaptain commented on Mar 6, 2025

    @skycaptain
    Contributor

    I'm kinda struggling to understand what hits this, it seems to occur in logs next to lots of git clones. I haven't really dived in deep, hopefully will find some time soon to do so!

    We're also experiencing this issue with v0.16.2 at the very end of pipelines, where we upload many cache artefacts first and then publish build artefacts as a container image. Interestingly, it happens to a lot of our pipelines, but it doesn't seem to be fully reproducible, as re-running the job (then mostly from the previously uploaded cache) passes fine.

  10. thaJeztah commented on Mar 6, 2025

    @thaJeztah

    😆 mmm, given we pull all of buildkit in and add lots of logic on top, I'm not entirely sure it'll be entirely straightforward

    Too bad! I'm definitely not familiar with the codebase here; was just hoping "maybe it's more straightforward than moby/moby (and straightforward enough to either bisect or report as-is)".

    it seems to occur in logs next to lots of git clones. I haven't really dived in deep, hopefully will find some time soon to do so!

    Yeah, it's very likely an issue in Golang; somewhat coincidentally, I think the report we received was during extraction of image layers, which either involved a re-exec, or shelling out to unpigz - in both cases that would involve spinning up a new process (?). That's just me thinking out loud (as usual), but in case that would give pointers.

  11. sipsma commented on Mar 6, 2025

    @sipsma
    Contributor

    FWIW I am on linux/arm64 and never saw this happen locally (despite running lots of git related tests lately that sound like they made this common for others on x86). Just in case there's some arch-specificity to this issue.

  12. thaJeztah commented on Mar 6, 2025

    @thaJeztah

    It's possible yes; from another ticket related to go1.24 that we ran into; (that one got fixed, after a git bisect found the offending commit); golang/go#71932 (comment)

    Directly related, no. This issue is arm64 only. However, this kind of bug, making an invalid pointer mid-pointer-arithmetic, has happened before (e.g. CL 225798), and I would not be terribly surprised if there's a similar bug lurking in amd64 (or other archs) somewhere.

  13. changed the title [-]SIGSEGV in dagger-engine after upgrade to go1.24[/-] [+]SIGSEGV in dagger-engine on linux/amd64 after upgrade to go1.24[/+] on Mar 6, 2025
  14. bupd commented on Mar 7, 2025

    @bupd
  15. MChorfa commented on Mar 10, 2025

    @MChorfa

    Same behavior with containerd

    Post "http://dagger/query": connection failed

    K3s, containerd, self-hosting, self signed certificates

  16. gmile commented on Mar 10, 2025

    @gmile
    Contributor

    As a data point: I'm seeing this error when using OrbStack, e.g. not official docker daemon, on macOS.

  17. added this to the v0.16.3 milestone on Mar 11, 2025
  18. jedevc commented on Mar 11, 2025

    @jedevc
    ContributorAuthor

    We'll be shipping a downgrade to this in v0.16.3, which we'll release tomorrow, March 12th - sorry, all!

  19. removed this from the v0.16.3 milestone on Mar 12, 2025
  20. nightah commented on Apr 2, 2025

    @nightah

    @jedevc I performed a bisect to try and identify the issue for Docker here.

    It could be worthwhile attempting to build against Go 1.24.2 with that specific bad commit reverted to confirm if it's indeed a common culprit.

    EDIT: It's worth reading this if you're attempting to test. I would suggest utilising custom-built Go at 327074551a2f22f2c0b8e444d1673c86f77ca745, which is the parent commit of the "bad commit".

  21. sipsma commented on Apr 2, 2025

    @sipsma
    Contributor

    More details in the docker thread, but I opened an issue w/ go here after finding an isolated repro: golang/go#73141

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/enginekind/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions