You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by al...@apache.org on 2020/04/14 19:31:16 UTC

[openwhisk-wskdebug] branch master updated (fb6606a -> 5d42407)

This is an automated email from the ASF dual-hosted git repository.

alexkli pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk-wskdebug.git.


    from fb6606a  update usage in readme for --cleanup and --ignore-certs options
     new 53889bb  ignore 503 errors with activation db agent
     new fca0acd  activation db agent tweaks
     new 5d42407  log api host and namespace

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/agentmgr.js | 52 ++++++++++++++++++++++++++++++++++++++--------------
 src/debugger.js |  3 ++-
 2 files changed, 40 insertions(+), 15 deletions(-)


[openwhisk-wskdebug] 03/03: log api host and namespace

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

alexkli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk-wskdebug.git

commit 5d42407d482eee1bae515e241de82948144a2e4b
Author: Alexander Klimetschek <ak...@adobe.com>
AuthorDate: Tue Apr 14 12:08:16 2020 -0700

    log api host and namespace
---
 src/debugger.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/debugger.js b/src/debugger.js
index 434f71f..8e2fb42 100644
--- a/src/debugger.js
+++ b/src/debugger.js
@@ -132,11 +132,12 @@ class Debugger {
             await this.watcher.start();
 
             console.log();
-            console.info(`Action     : ${this.actionName}`);
+            console.info(`Action     : /${this.wskProps.namespace}/${this.actionName}`);
             if (this.sourcePath) {
                 console.info(`Sources    : ${this.invoker.getSourcePath()}`);
             }
             console.info(`Image      : ${this.invoker.getImage()}`);
+            console.info(`OpenWhisk  : ${this.wskProps.apihost}`);
             console.info(`Container  : ${this.invoker.name()}`);
             console.info(`Debug type : ${this.invoker.getDebugKind()}`);
             console.info(`Debug port : localhost:${this.invoker.getPort()}`);


[openwhisk-wskdebug] 02/03: activation db agent tweaks

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

alexkli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk-wskdebug.git

commit fca0acd93df2bdaaaeba43c58d153c078c239b7c
Author: Alexander Klimetschek <ak...@adobe.com>
AuthorDate: Tue Apr 14 11:57:44 2020 -0700

    activation db agent tweaks
    
    - add hidden --disable-concurrency option to force it
    - shorten activation db timeout to 30 sec by default
    - better poll logging
---
 src/agentmgr.js | 52 ++++++++++++++++++++++++++++++++++++----------------
 1 file changed, 36 insertions(+), 16 deletions(-)

diff --git a/src/agentmgr.js b/src/agentmgr.js
index 7c5ebf0..4405b8d 100644
--- a/src/agentmgr.js
+++ b/src/agentmgr.js
@@ -192,15 +192,21 @@ class AgentMgr {
             debugTask("started local ngrok proxy");
 
         } else {
-            this.concurrency = await this.openwhiskSupports("concurrency");
+            if (this.argv.disableConcurrency) {
+                this.concurrency = false;
+            } else {
+                this.concurrency = await this.openwhiskSupports("concurrency");
+                if (!this.concurrency) {
+                    console.warn("This OpenWhisk does not support action concurrency. Debugging will be a bit slower. Consider using '--ngrok' which might be a faster option.");
+                }
+            }
+
             if (this.concurrency) {
                 // normal fast agent using concurrent node.js actions
                 agentName = "concurrency";
                 agentCode = await this.getConcurrencyAgent();
 
             } else {
-                console.warn("This OpenWhisk does not support action concurrency. Debugging will be a bit slower. Consider using '--ngrok' which might be a faster option.");
-
                 agentName = "polling activation db";
                 agentCode = await this.getPollingActivationDbAgent();
             }
@@ -282,9 +288,6 @@ class AgentMgr {
         // the $waitForActivation agent activation will block, but only until
         // it times out, hence we need to retry when it fails
         while (this.polling) {
-            if (this.argv.verbose) {
-                process.stdout.write(".");
-            }
             try {
                 let activation;
                 if (this.concurrency) {
@@ -297,6 +300,9 @@ class AgentMgr {
                         blocking: true
                     });
 
+                    if (this.argv.verbose) {
+                        process.stdout.write(".");
+                    }
                 } else {
                     // poll for the newest activation
                     const since = Date.now();
@@ -311,10 +317,6 @@ class AgentMgr {
                     }
 
                     while (true) {
-                        if (this.argv.verbose) {
-                            process.stdout.write(".");
-                        }
-
                         const activations = await this.wsk.activations.list({
                             name: `${name}_wskdebug_invoked`,
                             since: since,
@@ -335,11 +337,19 @@ class AgentMgr {
                             }
                         }
 
+                        if (this.argv.verbose) {
+                            process.stdout.write(".");
+                        }
+
                         // need to limit load on openwhisk (activation list)
                         await sleep(1000);
                     }
                 }
 
+                if (this.argv.verbose) {
+                    process.stdout.write(".");
+                }
+
                 // check for successful response with a new activation
                 if (activation && activation.response) {
                     const params = activation.response.result;
@@ -358,7 +368,7 @@ class AgentMgr {
 
                 } else if (activation && activation.activationId) {
                     // ignore this and retry.
-                    // usually means the action did not respond within one second,
+                    // usually means the action did not respond within one minute,
                     // which in turn is unlikely for the agent who should exit itself
                     // after 50 seconds, so can only happen if there was some delay
                     // outside the action itself
@@ -371,17 +381,27 @@ class AgentMgr {
             } catch (e) {
                 // look for special error codes from agent
                 const errorCode = getActivationError(e).code;
-                // 42 => retry
                 if (errorCode === 42) {
-                    // do nothing
+                    // 42 => retry, do nothing here (except logging progress)
+                    if (this.argv.verbose) {
+                        process.stdout.write(".");
+                    }
+
                 } else if (errorCode === 43) {
                     // 43 => graceful shutdown (for unit tests)
                     console.log("Graceful shutdown requested by agent (only for unit tests)");
                     return null;
+
                 } else if (e.statusCode === 503 && !this.concurrency) {
+                    // 503 => openwhisk activation DB likely overloaded with requests, warn, wait a bit and retry
+
+                    if (this.argv.verbose) {
+                        console.log("x");
+                    }
                     console.warn("Server responded with 503 while looking for new activation records. Consider using --ngrok option.")
-                    // can be server is overloaded with activation list requests, wait a bit extra and retry
-                    sleep(1000);
+
+                    await sleep(5000);
+
                 } else {
                     // otherwise log error and abort
                     console.error();
@@ -544,7 +564,7 @@ class AgentMgr {
                     code: fs.readFileSync(file, {encoding: 'utf8'})
                 },
                 limits: {
-                    timeout: (this.argv.agentTimeout || 300) * 1000
+                    timeout: (this.argv.agentTimeout || 30) * 1000
                 },
                 annotations: [
                     { key: "description", value: `wskdebug agent helper. temporarily installed.` }


[openwhisk-wskdebug] 01/03: ignore 503 errors with activation db agent

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

alexkli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk-wskdebug.git

commit 53889bbb4b62174c1a2dcfc2a747a9cc590ff4ad
Author: Alexander Klimetschek <ak...@adobe.com>
AuthorDate: Tue Apr 14 01:31:05 2020 -0700

    ignore 503 errors with activation db agent
---
 src/agentmgr.js | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/agentmgr.js b/src/agentmgr.js
index 3275b72..7c5ebf0 100644
--- a/src/agentmgr.js
+++ b/src/agentmgr.js
@@ -378,6 +378,10 @@ class AgentMgr {
                     // 43 => graceful shutdown (for unit tests)
                     console.log("Graceful shutdown requested by agent (only for unit tests)");
                     return null;
+                } else if (e.statusCode === 503 && !this.concurrency) {
+                    console.warn("Server responded with 503 while looking for new activation records. Consider using --ngrok option.")
+                    // can be server is overloaded with activation list requests, wait a bit extra and retry
+                    sleep(1000);
                 } else {
                     // otherwise log error and abort
                     console.error();