From 09020dd48261aad746bbc347e696e591e8416ed9 Mon Sep 17 00:00:00 2001 From: Rob Herley Date: Wed, 6 Dec 2023 19:01:28 -0500 Subject: [PATCH] debug --- dist/index.js | 201 +++++++++++++++++++++++++++++++++++++++++ src/upload-artifact.ts | 3 + 2 files changed, 204 insertions(+) diff --git a/dist/index.js b/dist/index.js index 357d8c5..1fc1f84 100644 --- a/dist/index.js +++ b/dist/index.js @@ -120808,6 +120808,123 @@ function regExpEscape (s) { } +/***/ }), + +/***/ 26819: +/***/ ((module) => { + +// Copyright 2012 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +function FormatStackTrace(error, frames) { + var lines = []; + try { + lines.push(error.toString()); + } catch (e) { + try { + lines.push(""); + } catch (ee) { + lines.push(""); + } + } + for (var i = 0; i < frames.length; i++) { + var frame = frames[i]; + var line; + try { + line = frame.toString(); + } catch (e) { + try { + line = ""; + } catch (ee) { + // Any code that reaches this point is seriously nasty! + line = ""; + } + } + lines.push(" at " + line); + } + return lines.join("\n"); +} + +module.exports = FormatStackTrace; + + +/***/ }), + +/***/ 14208: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + + +// v8 builtin format stack trace +// for when there was no previous prepareStackTrace function to call +var FormatStackTrace = __nccwpck_require__(26819); + +// some notes on the behavior below: +// because the 'stack' member is a one shot access variable (the raw stack is +// formatted on accessing it) +// we try to avoid modifying what the user would have wanted +// thus we use the previous value for prepareStackTrace +// +// The reason we store the callsite variable is because prepareStackTrace +// will not be called again once it has been called for a given error object +// but we want to support getting the stack out of the error multiple times (cause why not) +module.exports = function(err) { + + // save original stacktrace + var save = Error.prepareStackTrace; + + // replace capture with our function + Error.prepareStackTrace = function(err, trace) { + + // cache stack frames so we don't have to get them again + // use a non-enumerable property + Object.defineProperty(err, '_sb_callsites', { + value: trace + }); + + return (save || FormatStackTrace)(err, trace); + }; + + // force capture of the stack frames + err.stack; + + // someone already asked for the stack so we can't do this trick + // TODO fallback to string parsing? + if (!err._sb_callsites) { + return []; + } + + // return original capture function + Error.prepareStackTrace = save; + + return err._sb_callsites; +}; + + + /***/ }), /***/ 74294: @@ -121734,6 +121851,80 @@ function version(uuid) { var _default = version; exports["default"] = _default; +/***/ }), + +/***/ 49719: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var asyncHooks = __nccwpck_require__(50852) +var stackback = __nccwpck_require__(14208) +var path = __nccwpck_require__(71017) +var fs = __nccwpck_require__(57147) +var sep = path.sep + +var active = new Map() +var hook = asyncHooks.createHook({ + init (asyncId, type, triggerAsyncId, resource) { + if (type === 'TIMERWRAP' || type === 'PROMISE') return + if (type === 'PerformanceObserver' || type === 'RANDOMBYTESREQUEST') return + var err = new Error('whatevs') + var stacks = stackback(err) + active.set(asyncId, {type, stacks, resource}) + }, + destroy (asyncId) { + active.delete(asyncId) + } +}) + +hook.enable() +module.exports = whyIsNodeRunning + +function whyIsNodeRunning (logger) { + if (!logger) logger = console + + hook.disable() + var activeResources = [...active.values()].filter(function(r) { + if ( + typeof r.resource.hasRef === 'function' + && !r.resource.hasRef() + ) return false + return true + }) + + logger.error('There are %d handle(s) keeping the process running', activeResources.length) + for (const o of activeResources) printStacks(o) + + function printStacks (o) { + var stacks = o.stacks.slice(1).filter(function (s) { + var filename = s.getFileName() + return filename && filename.indexOf(sep) > -1 && filename.indexOf('internal' + sep) !== 0 + }) + + logger.error('') + logger.error('# %s', o.type) + + if (!stacks[0]) { + logger.error('(unknown stack trace)') + } else { + var padding = '' + stacks.forEach(function (s) { + var pad = (s.getFileName() + ':' + s.getLineNumber()).replace(/./g, ' ') + if (pad.length > padding.length) padding = pad + }) + stacks.forEach(function (s) { + var prefix = s.getFileName() + ':' + s.getLineNumber() + try { + var src = fs.readFileSync(s.getFileName(), 'utf-8').split(/\n|\r\n/) + logger.error(prefix + padding.slice(prefix.length) + ' - ' + src[s.getLineNumber() - 1].trim()) + } catch (e) { + logger.error(prefix + padding.slice(prefix.length)) + } + }) + } + } +} + + /***/ }), /***/ 69042: @@ -122052,6 +122243,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); +const why_is_node_running_1 = __importDefault(__nccwpck_require__(49719)); const core = __importStar(__nccwpck_require__(42186)); const artifact_1 = __importDefault(__nccwpck_require__(99860)); const search_1 = __nccwpck_require__(13930); @@ -122097,6 +122289,7 @@ function run() { } catch (error) { core.setFailed(error.message); + (0, why_is_node_running_1.default)(); } }); } @@ -122113,6 +122306,14 @@ module.exports = require("assert"); /***/ }), +/***/ 50852: +/***/ ((module) => { + +"use strict"; +module.exports = require("async_hooks"); + +/***/ }), + /***/ 14300: /***/ ((module) => { diff --git a/src/upload-artifact.ts b/src/upload-artifact.ts index 3706d2f..3e3dbb1 100644 --- a/src/upload-artifact.ts +++ b/src/upload-artifact.ts @@ -1,3 +1,5 @@ +import log from 'why-is-node-running' + import * as core from '../node_modules/@actions/core/' import artifact, { UploadArtifactOptions @@ -62,6 +64,7 @@ async function run(): Promise { } } catch (error) { core.setFailed((error as Error).message) + log() } }