Skip to content

detect if debug port is already used, e.g. by left over container #59

@alexkli

Description

@alexkli

If the debug port is already used on the system, the container start will fail and wskdebug will output a not-so-helpful error message:

Error: Command failed: docker run -d --name wskdebug-dump-1587406223576 --rm -m 268435456 -p 8080 -p 9229:9229 -e DEBUG='wskdebug' adobeapiplatform/adobe-action-nodejs-v10:3.0.21 node --expose-gc --inspect=0.0.0.0:9229 app.js 

This can actually be caused by wskdebug itself if a previous run failed to properly shutdown the container.

A better error message and even handling would be possible:

  1. (basic) check if the port is already in use on the local system before starting the container and if yes, show an error message "debug port 1234 already in use"

  2. (nicer) if positive, check if a docker container from wskdebug is the one with the open port:

    1. we should add the fully qualified action name as a label on the container: wskdebug-action=/namespace/package/action

    2. if it's the same action then log a note, kill it and proceed

    3. if it's another action, print a clear error message "debug port 1234 already in use by another wskdebug for action xyz"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions