Skip to content

🐞 Dagger exits with panic error & freezes my terminal #5765

@sharadregoti

Description

@sharadregoti

What is the issue?

Ran dagger run --focus node --loader ts-node/esm ./ci.mts which contains wrapper code over Dagger SDK in typescript

It runs sucessfully, but out of the blue i get this error. When i create a new terminal it starts working again & then again after some time i get this erro

Log output

Cannot copy logs, the terminal just freezes when dagger exits. Attaching screenshot

image

Steps to reproduce

java.mts

import { connect, Client, Container, Directory } from "@dagger.io/dagger"

// This uses TypeScript syntax for interfaces
interface Pipeline {
    installDependencies(
        applicationRootDirectory?: string
    ): void;
    build(): void;
    lint(): void;
    sca(): void;
    run(): void;
}

class AutoPipelineContainer {
    private from: string;
    private command: string;

    constructor(from?: string, command?: string) {
        this.from = from || ""
        this.command = command || ""
        console.log("=================== Seting command 2", this.command, this.from);
    }

    getFrom(): string {
        return this.from
    }

    getCommand(): string {
        console.log("=================== Seting command", this.command);
        return this.command
    }
}

class BuildDaggerContainer {
    private c: Client
    private apc: AutoPipelineContainer;
    private applicationRootDirectory: string;

    constructor(rc: AutoPipelineContainer, c: Client, applicationRootDirectory?: string) {
        this.apc = rc
        this.c = c
        this.applicationRootDirectory = applicationRootDirectory || "";

    }

    runContainer(): Container {
        const source = this.c.host().directory(".", {})

        let contd: Container = this.c.container()
        console.log("=================== Seting command 3", this.apc.getFrom(), this.apc.getCommand(), this.applicationRootDirectory);
        contd.from(this.apc.getFrom())
            .withExec(["bash", "-c", this.apc.getCommand()])
            .withDirectory("/mnt", source)
            .withWorkdir("/mnt")
            .stdout()
        return contd
    }
}

class JavaPipeline implements Pipeline {
    // @ts-ignore
    private idb: InstallDependenciesBuilder;
    private applicationRootDirectory: string;
    constructor(applicationRootDirectory?: string) {
        this.applicationRootDirectory = applicationRootDirectory || "";
    }

    installDependencies(): InstallDependenciesBuilder {
        this.idb = new InstallDependenciesBuilder(this);
        return this.idb;
    }

    build(): BuildBuilder {
        return new BuildBuilder(this);
    }

    lint() {
        // Java-specific linting logic
    }

    sca() {
        // Java-specific static code analysis logic
    }

    run() {
        connect(
            async (client: Client) => {
                // get reference to the local project

                const bc: BuildDaggerContainer = new BuildDaggerContainer(this.idb.getContainer(), client, this.applicationRootDirectory)
                bc.runContainer()

            },
            { LogOutput: process.stderr }
        )
    }
}


class InstallDependenciesBuilder {
    private javaPipeline: JavaPipeline;
    // @ts-ignore
    private container: AutoPipelineContainer;

    constructor(javaPipeline: JavaPipeline) {
        this.javaPipeline = javaPipeline;
        // this.container = new RespectContainer();
    }

    maven(): JavaPipeline {
        // Maven-specific build logic
        return this.javaPipeline;
    }

    gradle(
        version?: string,
        command?: string
    ): JavaPipeline {

        command = command || "cd /mnt/app; pwd; gradle"
        version = version || ""
        const from: string = 'openjdk' + version
        this.container = new AutoPipelineContainer(from, command)

        return this.javaPipeline;
    }

    getContainer(): AutoPipelineContainer {
        return this.container
    }
}


class BuildBuilder {
    private javaPipeline: JavaPipeline;
    // private container = Container;

    constructor(javaPipeline: JavaPipeline) {
        this.javaPipeline = javaPipeline;
        // this.container = new Container;
    }

    maven(): JavaPipeline {
        // Maven-specific build logic
        return this.javaPipeline;
    }

    gradle(): JavaPipeline {
        // Gradle-specific build logic
        return this.javaPipeline;
    }

    getContainer(): Container {
        let c: Container = new Container;

        return c
    }
}

export default JavaPipeline

ci.mts

import JavaPipeline from "./java.mjs";
const p = new JavaPipeline("app");
p.installDependencies().gradle()
p.run()

Dagger service is running on docker container v0.8.4 version

Run: 5-7 times (I used to keep change my execution command: ls, pwd, etc... for testing purpose in the code)
dagger run --focus node --loader ts-node/esm ./ci.mts

SDK version

"devDependencies": { "@dagger.io/dagger": "^0.8.4", "ts-node": "^10.9.1", "typescript": "^5.2.2" },

OS version

Linux

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions