No output logged when using `travis_wait` command

We are running CI on Xenial with Python 3.4 and are having issues with the travis_wait command. The command that we are trying to extend has been failing as soon as it’s executed. (It can’t persist). As soon as the command fails, the CI run does fail as whole as well, which is expected. However, there is never any output logged. This has been failing for a while now and we haven’t been able to figure it out because there is no error logs in the CI run. When the command was successful it would print the log, but never when the command fails. I even fixed the script to have it error after 15 seconds and it still didn’t output anything.

So in summary, the travis_wait command seems to output logs fine when successful, but if the command fails it suppresses the logs and never prints them.

Relevant run:
https://travis-ci.org/bitcoin/bitcoin/jobs/481036172

After that last gpg: command it’s running another script with travis_wait and there is no output. If you go to the raw log, you can see only a message that says:

Still running (1 of 50): contrib/verify-commits/verify-commits.py --clean-merge=2

but never any output from the script.

This has nothing to do with the use of travis_wait. You are setting the errexit option on the bash:

and this means that any command that exits with a nonzero status will terminate the build immediately.

travis_wait does not have a chance to dump the logs it is collecting.

Doh! Thanks for catching that. That makes a lot of sense. I’ll look into resolving it that way. Thanks!

same issue here !
log: https://travis-ci.org/google/or-tools/jobs/517767392
EDIT: my bad, as primary author specifies, logs do not appear until the process finish (or timeout)…
note: so the “Follow Log” feature become useless BTW

FYI .travis.yml

...
script:
  - >
    export -f travis_wait &&
    export -f travis_jigger &&
    ./.travis/script.sh ||
    travis_terminate 1

note: travis_jigger needed to avoid this https://travis-ci.org/google/or-tools/jobs/517744982#L288 -> maybe the travis-doc should be updated with a working example using a script.sh

inside script.sh I have one line containing

 ...
echo 'travis_fold:start:configure'
travis_wait cmake -H. -Bbuild -DBUILD_DEPS:BOOL=ON
echo 'travis_fold:end:configure'

before adding travis_wait, log looks like: https://travis-ci.org/google/or-tools/jobs/517655819

...
[ 44%] Performing update step for 'Protobuf_project'
-- Protobuf_project update command succeeded.  See also /home/travis/build/google/or-tools/build/dependencies/Protobuf/stamp/Protobuf_project-update-*.log
[ 55%] Performing configure step for 'Protobuf_project'
-- Protobuf_project configure command succeeded.  See also /home/travis/build/google/or-tools/build/dependencies/Protobuf/stamp/Protobuf_project-configure-*.log
[ 66%] Performing build step for 'Protobuf_project'
No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.
Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received
The build has been terminated

I have created a small CLI tool to fix this issue if you want to take a look : https://github.com/crazy-max/travis-wait-enhanced

I had similar problem , and I had python script launching all kind of commands - so I’ve decided - why python cannot just print some dummy message to keep travis ci satisfied. So I’ve coded following snipet, see:

pingTime = 5

stopTimer = False

def pingTravis(doPrint = True):
    if stopTimer:
        return

    if doPrint: 
        print("- Build still in progress...")
        sys.stdout.flush()

    threading.Timer(pingTime, pingTravis).start()

pingTravis(False)

execcmd("pause")

stopTimer = True

execcmd("pause")

execcmd can be replaced with os.system call. In code snipet above I’m using pause just if you want to test script locally, but final version can be found behind link below.

Here is a link to frozen version, switch to trunk if you want to get latest (but cannot guarantee that I will not recode it):
https://github.com/tapika/test_travis_ci/blob/b06c206d277882cd104f5224375daa9f63b66372/build.py