Skip to content

AsModule & Initialize not Properly Cached within the same session #8254

Closed

Description

@aluzzardi

We are calling two functions after AsModule().Initialize(), and the second one is not hitting cache:

mod := modConf.Source.AsModule().Initialize()

err = mod.Serve(serveCtx)
name, err := mod.Name(ctx)

https://dagger.cloud/dagger/traces/fefb70456e44a55fad89198adf9ef3ac?span=845b4c6062bbfaba

  • Serve
    • AsModule: 6.4s
    • Initialize: 2.1s
  • Name
    • AsModule: 501ms
    • Initialize: 1.6s

Additional context:

https://discord.com/channels/707636530424053791/1275839141929680957/1278063586786148353

/cc @sipsma @vito

Activity

  1. added
    kind/bug
    on Aug 28, 2024
  2. sipsma commented on Aug 31, 2024

    @sipsma
    Contributor

    I didn't get time to dive into before PTO, so just leaving a few breadcrumbs if anyone picks it up before I'm back:

    1. I'm confused why the impure API runs twice despite sdks: Sync doesn't always work as expected with certain APIs #7788 being fixed
      • The second run is only adding like 30ms overhead atm, but if this wasn't happening we wouldn't be reloading any context and would be side-stepping this problem. So worth understanding at some point
    2. The main problem seems to be some non-determinism in loading the local source blob, things to look at:
  3. marcosnils commented on Sep 19, 2024

    @marcosnils
    Contributor

    @aluzzardi have you checked if this improved after v0.13.1? As Erik mentioned, we think #8471 should have fixed some of these aspects 🙏

  4. helderco commented on Apr 21, 2025

    @helderco
    Contributor

    @sipsma, this is no longer a thing since there's no more "Module.initialize" function, right?

  5. sipsma commented on Apr 22, 2025

    @sipsma
    Contributor

    @sipsma, this is no longer a thing since there's no more "Module.initialize" function, right?

    yep! And the various caching issues w/ module loading have been addressed, I'll close this out for now

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

    kind/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions