Search code examples
cloud-foundryibm-cloud

Is my Bluemix CF app running when I see `?/0` responses to the `cf apps` command?


Sometimes I run the CF CLI command to check my apps (cf apps) and get weird instance information in the response. For example:

cf a
Getting apps in org patmc.../ space testspace as patmc...
OK

name                         requested state   instances   memory   disk   urls
oom-rt-nodesdk-bp-asis       started           ?/1         512M     1G     oom-rt-nodesdk-bp-asis.mybluemix.net
oom-rt-nodesdk-service-MnA   started           ?/1         384M     1G     oom-rt-nodesdk-service-MnA.mybluemix.net
oom-rt-nodesdk-service-no    started           ?/1         256M     1G     oom-rt-nodesdk-service-no.mybluemix.net

Why do I see ?/1 in the instances column as the response for my apps?

Are my apps running or not?


Solution

  • The CF CI command cf apps (or cf a) returns the state of your apps in the current org/space.

    That command should tell you if they are started, or stopped, and how many instances are running (0/1, 1/1, 0/2, 2/2, and so on).

    The app state information comes from a layer in Cloud Foundry called HM9000 (or hm9000, or in some chatter, hm9k/hm9K).

    If hm9k says your app is up you see 1/1, if it says it is down you see 0/1, if it does not know, or can't respond, then you get ?/1 as the app instances state.

    Does that really mean the app is down? No.

    Most of the time if you had started the app, it will still be running. If you just open the URL for the app it should respond. If you hadn't checked the results of the cf apps command first, you would not have even have thought about the possibility that your app might be down (running apps rule !!).

    The real problem is that when hm9k is not being responsive, not only do you see the ?/1 response, but the Bluemix web UI will interpret that same info and put "Not running" in the UI. Bluemix UI snippet of what is shown for <code>?/1</code> responses.

    That can be a bit shocking to see, as all your started/running apps are screaming at you when they all say "Not running" or ?/1.

    But, as with the cf apps response, this information in the UI is not always correct; the UI doesn't really know as the hm9k response was indeterminate. Even more painful is that the link to open your app in the Bluemix UI won't work (you have to cut/paste the URL). The Bluemix UI seems to disable the link that is shown, based on the "Not running" (?/1) state. If you already had the app open, or used a bookmark to open the app, or did a copy/paste of the URL to open the app, it will be there (if you had started it previously of course).

    Net: If you see ?/1 responses from the CF CLI cf apps command, or "Not running" in the Bluemix UI, check the app URL directly, or tail the log with cf logs yourAppName to see if the app is generating log content. Most of the time the app will be there and waiting to do your bidding.

    I'm about to go bother some Bluemix UI folks to see if we can't get that <"Not running" == "not a clickable app url"> behavior changed. I'd rather click and fail, than not be able to click, given that for "Not running", it will typically be "if you could click, it would work".

    Review this content if you would like to better understand the hm9000 Cloud Foundry component: