bartholomew icon indicating copy to clipboard operation
bartholomew copied to clipboard

Cannot create Cache file

Open kingdonb opened this issue 1 year ago • 4 comments

I found this message in my logs after running the "Taking Bartholomew for a spin" walkthrough and I'm not really sure why!

I found the message in the code as well, but not really a rustacean (yet) and so I'm raising an issue about it here to understand the situation with the cache. Is it something wrong with the permissions on my local filesystem, perhaps?

kingdonb avatar Feb 26 '23 18:02 kingdonb

By default, spin does not allow writing to the file system but bartholomew tries to cache in the list of files to make it faster and the message appears because of the inability to write to a file system by default.

There is an option --allow-transient-write for spin which would allow bartholomew to write a cache file. Just as an addituional note, writing to a file is not allowed in the cloud.

karthik2804 avatar Feb 26 '23 23:02 karthik2804

@tpmccallum Is this worth adding to the docs in a FAQ/troubleshooting section? The cache messages will be a lot more visible now that Spin defaults to sending all guest output to the console.

@karthik2804 Do you think we should tweak the message to indicate that this is expected / benign (and maybe the scope? Is it only for building the TOC? Not sure)? And/or to mention how to enable the cache?

itowlson avatar Feb 27 '23 00:02 itowlson

@itowlson, the scope of caching currently is to only make it more efficient by reading a singular file instead of reading a bunch of different files on each request. We could go down the route of tweaking the message or we can also potentially go ahead and make the usage of the cache disabled by default instead of it being enabled now that this is the default behavior of spin.

The original implementation was done when spin still allowed transient writes by default.

karthik2804 avatar Feb 27 '23 01:02 karthik2804

I found the OCI docs and the bindle docs, I'm running this stuff on Kubernetes:

https://github.com/kingdonb/taking-bartholo/blob/main/ci-scripts/spin-up.sh https://github.com/kingdonb/taking-bartholo/blob/5b4832a8b1c5101f2b33d0736a0bf9716b041c42/.github/workflows/spin-publish.yaml#L34 https://github.com/kingdon-ci/fleet-infra/tree/main/examples/wasm/taking-bartholo

I'm sure this is pretty far from the intended design now that I got it working, but FWIW the deployment --from-registry also emits the Cannot create Cache file message, for a little while at least it seems as well.

I'll have a look into how this might be made to work with bindle, if that has anything to do with caching? Then each pod only pulls the content it needs, and in case my blog has large files that don't need to load on the landing page / with infrequent access, the OCI image could become enormous. I haven't read everything, don't know what the direction is exactly, but I saw that OCI feature is new, and it was just what I needed to get up and running!

I'd like to either get rid of those messages or enable caches, but it's not blocking me.

I think I see how to enable caching from the top post in reply:

--allow-transient-write eb4d2f9628b06a9c5997f2957bac99cf43f279e3

Thanks for answering my question!

I got some other errors with that flag in place:

Writing string  is 0
Writing Expiry Time is Err(
    ParseError(
        TooShort,
    ),
)

but I'm satisfied for now and will follow for more info as it surfaces, as the rendering is plenty fast, and I'm able to use this and follow what's going on pretty well 👍❤️ looking forward to trying out the Hippo Factory on tf-controller one day soon!

kingdonb avatar Feb 27 '23 03:02 kingdonb