Skip to content

python stack traces sometimes not logged until concurrently terminated #241

Open
@crvarner

Description

@crvarner

concurrently version: 5.3.0

Starting webpack and flask app via npm start and the following scripts in package.json

    "scripts": {
        "start": "concurrently --kill-others -n webpack,flask -c blue,green \"npm:webpack\" \"PORT=${PORT:-5001} npm run flask\"",
        "flask": "DEVPORTAL_CFG=../development.cfg FLASK_APP=devportal PYTHONDONTWRITEBYTECODE=1 FLASK_ENV=development flask run --port=$PORT",
        "webpack": "webpack --config webpack.dev.js",

the flask app contains the following lines:

    log.info("log.info works normally")
    log.info("log.error works normally")
    raise Exception("ERROR")

repeating the request that executes these lines results in the following log output:

[flask] 2020-09-04 18:12:03,840 | devportal.api.auth |   INFO | log.info works normally
[flask] 2020-09-04 18:12:03,840 | devportal.api.auth |  ERROR | log.error works normally
[flask] Traceback (most recent call last):
        ... stacktrace ...
[flask]     raise Exception("ERROR")
[flask] Exception: ERROR
[flask] 2020-09-04 18:12:08,165 | devportal.api.auth |   INFO | log.info works normally
[flask] 2020-09-04 18:12:08,165 | devportal.api.auth |  ERROR | log.error works normally
[flask] 2020-09-04 18:12:09,145 | devportal.api.auth |   INFO | log.info works normally
[flask] 2020-09-04 18:12:09,146 | devportal.api.auth |  ERROR | log.error works normally
[flask] 2020-09-04 18:12:09,987 | devportal.api.auth |   INFO | log.info works normally
[flask] 2020-09-04 18:12:09,987 | devportal.api.auth |  ERROR | log.error works normally

Note the stacktrace was only logged once. terminating command vi CTRL-C results in the missing traces being logged:

^C[flask] Traceback (most recent call last):
        ... stacktrace ...
[flask] Exception: ERROR
[flask] Traceback (most recent call last):
        ... stacktrace ...
[flask] Exception: ERROR
[flask] Traceback (most recent call last):
        ... stacktrace ...
[flask] Exception: ERROR
[webpack] npm run webpack exited with code 0
--> Sending SIGTERM to other processes..
[flask] PORT=5001 npm run flask exited with code 0

Concurrently logs traces correctly when the --raw flag is set. Any ideas whether this is user error or a bug?

reproduction: https://github.com/crvarner/concurrently_bug.git

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions