Why does the container occasionally redownload all parts of its packages?


#1

Hi! Every now and then, I log on to my glitch project and see

Resolving: total 159, reused 96, downloaded 26

Resolving: total 159, reused 96, downloaded 26

Resolving: total 159, reused 96, downloaded 26

Resolving: total 159, reused 96, downloaded 26

Resolving: total 159, reused 96, downloaded 26

Resolving: total 159, reused 96, downloaded 26

Resolving: total 159, reused 96, downloaded 26

Resolving: total 159, reused 96, downloaded 26

Resolving: total 159, reused 96, downloaded 26

Resolving: total 159, reused 96, downloaded 26

Resolving: total 159, reused 96, downloaded 26

Resolving: total 159, reused 96, downloaded 26

Resolving: total 159, reused 96, downloaded 26

Resolving: total 159, reused 96, downloaded 27

Resolving: total 159, reused 96, downloaded 27

Resolving: total 159, reused 96, downloaded 27

Resolving: total 159, reused 96, downloaded 27

Resolving: total 159, reused 96, downloaded 27

Resolving: total 159, reused 96, downloaded 27

Resolving: total 159, reused 96, downloaded 27

Resolving: total 159, reused 96, downloaded 27

Resolving: total 159, reused 96, downloaded 27

Resolving: total 159, reused 96, downloaded 27

Resolving: total 159, reused 96, downloaded 27

Resolving: total 159, reused 96, downloaded 27

Resolving: total 159, reused 96, downloaded 27

Resolving: total 159, reused 96, downloaded 27

Resolving: total 159, reused 96, downloaded 29

Resolving: total 159, reused 96, downloaded 29

Resolving: total 159, reused 96, downloaded 30

Resolving: total 159, reused 96, downloaded 30

Resolving: total 159, reused 96, downloaded 30

Resolving: total 159, reused 96, downloaded 31

Resolving: total 159, reused 96, downloaded 31

Resolving: total 159, reused 96, downloaded 33

Resolving: total 159, reused 96, downloaded 34

Resolving: total 159, reused 96, downloaded 35

Resolving: total 159, reused 96, downloaded 36

Resolving: total 159, reused 96, downloaded 37

Resolving: total 159, reused 96, downloaded 37

Resolving: total 159, reused 96, downloaded 39

Resolving: total 159, reused 96, downloaded 40

Resolving: total 159, reused 96, downloaded 43

Resolving: total 159, reused 96, downloaded 43

Resolving: total 159, reused 96, downloaded 43

Resolving: total 159, reused 96, downloaded 43

Resolving: total 159, reused 96, downloaded 43

Resolving: total 159, reused 96, downloaded 43

Resolving: total 159, reused 96, downloaded 43

All the way until everything is downloaded. Is there a reason for this? I was just curious. At first I thought it was updating a package but it takes quite awhile (5-10 minutes). Thanks!


#2

I’ve had this issue a number of times, for example Awakening causes request timeouts due to NPM reinstall.

I just experienced a similar issue, but worse. The SQLite compilation appeared to get the VM throttled for using too much memory. I don’t think I’ve run into that one before, but here was the result after the VM got un-throttled:

image%20(1)

Not good when it’s running a simple Slack bot. Can something prevent this issue?


#3

Hi @ericyangwa, Glitch projects restart after ~5 mins of inactivity, and when they restart they need to reinstall your dependencies. Might that be what’s triggering your reinstallation?

If so, it shouldn’t take 5-10 minutes to perform, so I’d be interested in taking a closer look if you’re willing to share your project name.

@abrobston, we’ve observed continual intermittent problems with the better-sqlite3 package, and when it gets into a bad state the only thing we’ve found that reliably resolves it is to manually reenable pnpm using enable-pnpm in your project’s console. Sorry for the bother!


#4

It looks like all enable-pnpm does is delete the node_modules directory and sync the web environment with the console. Perhaps doing so triggers pnpm to re-download all the dependencies, but what would cause pnpm to be disabled such that it needs to be re-enabled? What are the intermittent problems with better-sqlite3 that you have noticed?


#5

@abrobston enable-pnpm is a shortcut to forcing a reinstall of the required packages. It also switches your project from npm to pnpm if you’re currently using npm, which uses the shared pnpm module store and keeps your node modules from taking up space in your project.

As far as better-sqlite3 is concerned, there seems to be something with how better-sqlite3 expects things to be cached. This issue gives some hope that it might be fixed in a relatively recent release, but I haven’t verified that.