Skip to content

[BUG] fly intercept randomly asks to choose container although step is passed on command-line #2067

Closed

Description

@marco-m

Bug Report

What challenge are you facing?

I have pipeline hello with job hello.j which contains two tasks, say-hello-1.t and say-hello-2.t. I want to fly intercept in a non-interactive way, so I specify on the command-line the task I want to intercept:

fly -t tutorial intercept -j hello/hello.j -s say-hello-1.t

Randomly fly behaves as if the -s say-hello-1.t was not specified and drops in interactive mode:

1: build #169, step: say-hello-1.t, type: task
2: build #174, step: say-hello-1.t, type: task
choose a container:

Since i am running intercept under watch (watch fly -t tutorial intercept -j hello/hello.j -s say-hello-1.t ps aux), the effect is that the intercept hangs forever and watch doesn't have the possibility to re-run my intercept each 2 seconds.

Since the two tasks run very fast, maybe this is a race condition somewhere in fly logic / query ?

How to reproduce

    resources:
    - name: every-1m
    type: time
    source: {interval: 1m}

    jobs:
    - name: hello.j
    plan:
    - get: every-1m
        trigger: true
    - task: say-hello-1.t
        config:
        platform: linux
        image_resource:
            type: docker-image
            source: {repository: ubuntu}
        run:
            path: echo
            args: ["Hello 1!"]
    - task: say-hello-2.t
        config:
        platform: linux
        image_resource:
            type: docker-image
            source: {repository: ubuntu}
        run:
            path: echo
            args: ["Hello 2!"]

I think the time resource can be removed. You can keep triggering the job on the web UI and keep running fly intercept, sometimes you get the container shell (or the ps output if specified), sometimes you get the choose a container: prompt.

A Modest Proposal

Fixing the root cause would be great, but I was thinking, in any case adding a flag --no-interactive to fly intercept, with the behavior of always failing instead of asking to chose a container, could be beneficial also outside my use case.

Imagine for example running something like fly -t tutorial intercept -j hello/hello.j -s say-hello-1.t ps aux from a script, you really don't want it to hang :-)

The following can also be handy:

  • Concourse version: 3.9.1
  • Deployment type (BOSH/Docker/binary): binary
  • Infrastructure/IaaS: test deployment in a VM (ATC and 1 worker on same VM)
  • Browser (if applicable): N/A
  • Did this used to work? don't know

Activity

  1. changed the title [-]fly intercept randomly asks to choose container although step is passed on command-line[/-] [+][BUG] fly intercept randomly asks to choose container although step is passed on command-line[/+] on Mar 13, 2018
  2. marco-m commented on Mar 26, 2018

    @marco-m
    ContributorAuthor

    hello ?

  3. self-assigned this
    on Mar 29, 2018
  4. shashwathi commented on Mar 29, 2018

    @shashwathi
    Contributor

    @marco-m :

    Randomly fly behaves as if the -s say-hello-1.t was not specified and drops in interactive mode:

    If you have containers matching the name of task with multiple builds, then interactive option is prompted. To avoid this try to add -b, --build= to mention a specific build number. Another option would be to try -u, --url= along with -s too.

    To avoid watch hang for a prompt consider using either URL(-u) + -s or use -j, -s and -b option.

  5. marco-m commented on Mar 29, 2018

    @marco-m
    ContributorAuthor

    Ah @shashwathi thanks, you made me realize that I confused two things. I Though that the only reason for fly intercept to drop to interactive mode was if the step was not specified (and this is what I put in the title of this ticket), while it is clear that it was as you mention: fly was asking me to select the build, not the step:

    1: build #169, step: say-hello-1.t, type: task
    2: build #174, step: say-hello-1.t, type: task
    choose a container:
    

    Having cleared this misunderstanding on my side, here is what I think:

    • the --url or --build still don't solve my problem, because if one runs fly under watch, one cannot / doesn't want to specify a build, one would like the "latest" build.
    • maybe we could introduce a special value for --build that means "latest" ?
    • still the --no-interactive flag with guaranteed failure in case of non-uniqueness looks like useful to me.

    What do you think?

  6. shashwathi commented on Mar 29, 2018

    @shashwathi
    Contributor

    maybe we could introduce a special value for --build that means "latest" ?

    I am not a fan of using this practice.

    still the --no-interactive flag with guaranteed failure in case of non-uniqueness looks like useful to me.

    I do like the approach of -n where build number should point to latest build information.

    Questions

    Consider an example where build 1,2,3 are triggered and containers for build 3 are deleted after a while, -n would ssh into build 2 container but technically its not the latest. Is this misleading to a user? How to make it clear that latest build containers are not available anymore?

    @vito : Thoughts?

  7. marco-m commented on Apr 4, 2018

    @marco-m
    ContributorAuthor

    Regarding your question with the example, -n should fail if the latest container is not available, it should not fall back to "the latest available container". This to follow POLA: Principle Of Least Astonishment. Maybe one way to make it clear that the latest container is not available any more is to return a 5XX code with a text message ?

  8. marco-m commented on Apr 16, 2018

    @marco-m
    ContributorAuthor

    Hello @shashwathi, any news ?

  9. vito commented on Apr 16, 2018

    @vito
    Contributor

    @marco-m If there are no replies then there is no news. :) Lots of things to do, so little time.

    I think we could have --non-interactive target only the latest build. If the latest build has no matching containers, it should fail. As an added bonus, we could have fly auto-detect non-interactive for things like watch by checking if stdin is a tty.

  10. marco-m commented on Apr 16, 2018

    @marco-m
    ContributorAuthor

    @vito @shashwathi Thanks for the answer, and sorry for the noise, I will set my timeout longer :-)

  11. stale commented on Jul 31, 2019

    @stale

    Beep boop! This issue has been idle for long enough that it's time to check in and see if it's still important.

    If it is, what is blocking it? Would anyone be interested in submitting a PR or continuing the discussion to help move things forward?

    If no activity is observed within the next week, this issue will be exterminated closed, in accordance with our stale issue process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions