#Function Caching + Interfaces Possible Bug

1 messages · Page 1 of 1 (latest)

silk smelt
#

Hi there guys. I may have found a bug when using function caching with interfaces (specifically when using module constructors). I have been testing on 0.19.6 and 0.19.4.
I have the following drive module which accepts a car as an interface:

package main

import "context"

type Drive struct {
    Car Car
}

func New(car Car) *Drive {
    return &Drive{Car: car}
}

func (d *Drive) DriveIt(ctx context.Context) error {
    return d.Car.Drive(ctx)
}

type Car interface {
    DaggerObject
    Drive(ctx context.Context) error
}

When invoking driveit 2 times in a row, I end up with a weird error message the second time:

! collect IDs: failed to convert field "Car": load interface implementation: schema: load source mod: load asModule: load: load base: load base: local
  path "/Users/christopher.palmer/workspace/library-ci-workflows/function-caching-test/drive" does not exist

Here is a repo to reproduce the issue: https://github.com/chrisjpalmer/function-caching-test/tree/master

If you run:

dagger call drive-rolls-royce
dagger call drive-rolls-royce

It should produce the above error on the second call.

Note: The problem goes away if I add // +cache="never" to the constructor of the drive module.

silk smelt
#

@main night

silk smelt
#

Hey @main night has there been any update on this one ? We would love to update dagger but are currently blocked as we use interfaces in our pipelines.

main night
silk smelt
#

Really appreciate that! Thanks so mcuh

main night
#

I seem to have the fix, pushing the PR (there might be broarder implications though, so not 100% sure about the fix)

main night
silk smelt
#

Ahh amazing

#

Thank you Guillaume!

#

Cant wait to get my hands on the latest dagger version :):):)

main night