Hmm. Well, that’s the first hypothesis out of the way. Here are the next two most common issues we’ve seen:
1. Entropy depletion
The Linux kernel has historically had funny ideas about entropy, which cause it to pause when it doesn’t think it’s seen enough random events lately (such as IO times, network packet arrival times, or sometimes hardware randomness). This can be particularly exacerbated by running in a virtual machine, which offers less exposure to randomly-timed hardware events.
Unfortunately, by default, the JVM uses /dev/random
, the randomness source most affected by funny ideas about entropy, and during startup we need a fair bit of it.
Consider configuring your JVM to use /dev/urandom
instead (observe the warning about including /./
in the path – that one cost us a fair amount of pain in our production environment, a few years back), or configuring your hypervisor and/or VM to get hardware randomness.
2. Something strange with DNS
Sometimes, if the JVM (or, indeed, any UNIX program) hangs for ages when starting up, it’s because it tried to look something up in DNS, or do a reverse-lookup on some IP address, and is hanging waiting for a response. This can have any number of causes, but the best way to diagnose it is to use strace
to dump the system calls the JVM is running, and see what it’s hanging on. You might also want to check your DNS resolution settings (/etc/resolv.conf
and friends), and make sure you can resolve your machine’s hostname.
3. Filesystem shenanigans
This is a long shot, but one of the first things the App Server does in its default configuration is unpack its embedded Postgres server, and if you’re doing something funny with filesystems (eg NFS) this can sometimes lock up. Again, strace
is usually your friend.
Appendix: Or, why we don’t offer much free support for the App Server
To take a peek behind the curtain for a moment, this post is a perfect demonstration of why we generally don’t promise support for the App Server (except on a support plan, and even then the App Server costs extra). More to the point, this is why we built Anvil as a cloud platform in the first place!
It’s not that we’re mean or miserly, or don’t believe in open source; it’s just that this sort of question rapidly descends into debugging strange idiosyncrasies of your particular computer. Because the causes are frequently so obscure, this tends to require a lot of time from quite senior engineers (writing out this post directly delayed releasing a new platform feature, and we’re a small team who can’t afford to do that very often - especially for a post that might not even solve your problem!). What’s worse, all this effort very rarely helps the next user, whose system will be idiosyncratic in a different way.
We happily offer support to everyone on this forum, including Free-plan users who will never pay us a penny, because in general answering their questions helps the next dozen people who have the same question. Unfortunately, “what strange thing is the App Server doing on my server?” rarely has those characteristics