Commit graph

1598 commits

Author SHA1 Message Date
joeduffy 9c7f6b678c Bring LUMIDL up to code
This gets LUMIDL to generate code in the new way.
2017-09-11 16:58:25 -07:00
joeduffy 791b90aa33 Swap sdk / nodejs 2017-09-11 15:34:06 -07:00
joeduffy 2ef6b89b82 Add one-time Travis make configure in build dir 2017-09-11 15:30:42 -07:00
joeduffy 4c781da93b Add instructions for make configure
And also move the Node.js SDK-specific parts into the sdk/nodejs/ directory.
2017-09-11 15:17:11 -07:00
joeduffy ac786ed2c9 Clean up the READMEs 2017-09-11 13:18:09 -07:00
Luke Hoban 4704ac75fc Use curl instead of wget
Since wget is not installed by default on MacOS.
2017-09-11 09:33:54 -07:00
joeduffy 353b25205a Make install scripts part of the fabric LKG 2017-09-10 20:23:11 -07:00
joeduffy cf7ba79f81 Skip __awaiter this captures 2017-09-10 09:22:04 -07:00
joeduffy 443e1b9053 Use hasOwnProperty in case e.json is undefined 2017-09-10 08:24:02 -07:00
joeduffy 8ce07617c9 Implement recursive closure captures
This change implements recursive closure captures.  This permits
cases like the following

    {
        function f() { g(); }
        function g() { f(); }
    }

and the slightly more useful

    class C {
        this.x = 42;
        this.f = () => x;
    }

To do this requires caching the environment objects and permitting
cycles in the resulting environment graph.  The closure emitter code
already knows how to handle this.

In addition, we must mark captures of `this` as free variables.

This resolves pulumi/pulumi-fabric#333.
2017-09-10 07:40:53 -07:00
joeduffy 07f2c92c84 Add a custom unhandled promise error handler 2017-09-09 18:10:13 -07:00
joeduffy 1a64fc4bf3 Keepalive the RPC client until logs finish
This ensures RPC channels stay alive until logs finish.  It also
makes provisions for logs that come in *after* shutdown has begun,
but before it has finished, by observing that the keepalive promise
has changed between the time of initiating the callback and running it.
2017-09-09 14:09:21 -07:00
joeduffy 871943abfc Dial back the debug output slightly 2017-09-09 13:49:50 -07:00
joeduffy f9995159c6 Fix a handful of things, mostly logging
* Initialize the diganostics logger with opts.Debug when doing
  a Deploy, like we do Plan.

* Don't spew leaked promises if there were Log.errors.

* Serialize logging RPC calls so that they can't appear out of order.

* Print stack traces in more places and, in particular, remember
  the original context for any errors that may occur asynchronously,
  like resource registration and calls to mapValue.

* Include origin stack traces generally in more error messages.

* Add some more mapValue test cases.

* Only undefined-propagate mapValue values during dry-runs.
2017-09-09 13:43:51 -07:00
joeduffy f74e9e04bd Ensure we fail during deploys
If an error gets emitted during a deployment, we should fail.
This also reenables colors that seems to have gotten lost somewhere.
2017-09-09 12:42:04 -07:00
joeduffy f75b465052 Add some contextual error information 2017-09-09 11:19:35 -07:00
joeduffy 0147d487bd Serialize all resource operations
This change serializes all resource operations.  Please see
pulumi/pulumi#335 for more details.  In a nutshell, there are
resources that have implicit hidden dependencies and now that
the runtime is fully asynchronous, we are tripping over problems
left and right (even worse, they are non-deterministic).  All
of the problems have been in the AWS API Gateway resources;
until we come up with a holistic solution here, serializing all
calls should make things more stable in the interim.
2017-09-09 10:32:25 -07:00
joeduffy 8aba3aae12 Upgrade gRPC to 1.6.0; use full addresses
This change upgrades gRPC to 1.6.0 to pick up a few bug fixes.

We also use the full address for gRPC endpoints, including the
interface name, as otherwise we pick the wrong interface on Linux.
2017-09-09 07:37:10 -07:00
joeduffy 67e5750742 Fix a bunch of Linux issues
There's a fair bit of clean up in here, but the meat is:

* Allocate the language runtime gRPC client connection on the
  goroutine that will use it; this eliminates race conditions.

* The biggie: there *appears* to be a bug in gRPC's implementation
  on Linux, where it doesn't implement WaitForReady properly.  The
  behavior I'm observing is that RPC calls will not retry as they
  are supposed to, but will instead spuriously fail during the RPC
  startup.  To work around this, I've added manual retry logic in
  the shared plugin creation function so that we won't even try
  to use the client connection until it is in a well-known state.
  pulumi/pulumi-fabric#337 tracks getting to the bottom of this and,
  ideally, removing the work around.

The other minor things are:

* Separate run.js into its own module, so it doesn't include
  index.js and do a bunch of random stuff it shouldn't be doing.

* Allow run.js to be invoked without a --monitor.  This makes
  testing just the run part of invocation easier (including
  config, which turned out to be super useful as I was debugging).

* Tidy up some messages.
2017-09-08 15:11:09 -07:00
joeduffy 13df916cfe Put the Node.js SDK bin/ on $PATH for Travis 2017-09-08 06:19:22 -07:00
joeduffy 6aae028768 Move language host into bin/ 2017-09-08 06:13:09 -07:00
joeduffy 527aee7b15 Clone pulumi 2017-09-07 21:52:58 -07:00
joeduffy f3088149ec Make scripts agnostic to pwd 2017-09-07 21:29:50 -07:00
joeduffy 8180914f83 Don't keep the message loop alive during logging 2017-09-07 21:14:29 -07:00
joeduffy 4e96400c9e Only print leaks on successful exits 2017-09-07 15:19:08 -07:00
joeduffy ebc3bf1dd0 Reap the language host process 2017-09-07 15:03:48 -07:00
joeduffy a5a6c79925 Keep RPC connections alive for as long as we need them
The change to tear down RPC connections after the program exits --
to fix problems on Linux presumably due to the way libuv is implemented --
unfortunately introduces nondeterminism and overzealous termination that
can happen at inopportune times.  Instead, we need to wait for the current
RPC queue to drain.  To fix this, we'll maintain a list of currently active
RPC calls and, only once they have completed, will we close the clients.
2017-09-07 14:50:17 -07:00
joeduffy c6b626899b Flatten the Node.js SDK release structure 2017-09-07 14:33:00 -07:00
joeduffy 88a87569f5 Link the bin/ directory
This moves us closer to what we'll have with real NPM packages.
2017-09-07 12:43:12 -07:00
joeduffy b23338d4d1 Disconnect from the host/engine properly 2017-09-07 12:33:43 -07:00
Joe Duffy 0e3a01c684 Update the publish scripts for the new package structure (#334) 2017-09-07 11:07:52 -07:00
joeduffy d845c9e08c Publish and install the new layout 2017-09-07 09:56:26 -07:00
joeduffy 7f41f6e186 Update dependencies to latest 2017-09-07 09:02:15 -07:00
Joe Duffy dbd0e2ad4b Merge pull request #328 from pulumi/311_v8
Switch to a Node.js/V8-based runtime
2017-09-07 08:41:25 -07:00
joeduffy dcefa4a9d4 Close gRPC client connections
This change closes the gRPC client connections, as they keep the
Node.js message loop alive on Linux (but, strangely, not Mac;
regardless, a good thing to do anyway...)
2017-09-07 08:32:36 -07:00
joeduffy f64b8e25e7 Clean up legacy examples 2017-09-07 07:59:16 -07:00
joeduffy 6147afb7d1 Fix cp command on Linux 2017-09-07 07:36:10 -07:00
joeduffy 0d2f84c194 Fix github.com/pkg/errors reference 2017-09-07 07:25:08 -07:00
joeduffy 470a519057 Add Promises leak and hang detection
We have an issue in the runtime right now where we serialize closures
asynchronously, meaning we make it possible to form cycles between
resource graphs (something that ought to be impossible in our model,
where resources are "immutable" after creation and cannot form cycles).

Let me tell you a tale of debugging this ...

Well, no, let's not do that.  But thankfully I've left behind some
little utilities that might make debugging such a thing easier down
the road.  Namely:

* By default, most of our core runtime promises leverage a leak handler
  that will log an error message should the process exit with certain
  critical unresolved promises.  This error message will include some
  handy context (like whether it was an input promise) as well as a
  stack trace for its point of creation.

* Optionally, with a flag in runtime/debuggable.ts, you may wire up
  a hang detector, for situations where we may want to detect this
  situation sooner than process exit, using the regular message loop.
  This uses a defined timeout, prints the same diagnostics as the
  leak detector when a hang is detected, and is disabled by default.
2017-09-06 18:35:20 -07:00
joeduffy 93743733fb Explicitly serialize output properties in closures 2017-09-06 14:51:00 -07:00
joeduffy aefe297aa1 Harden dependent resolutions
This fixes a few problems with dependent resolutions and hardens
even more promises-related error paths, so we swallow precisely zero
errors (or at least we hope so).  This also digs through multi-level
chains of promises and computed properties as needed for nested mapValues.
2017-09-06 14:29:17 -07:00
joeduffy 397fea5720 Permit undefined values to flow through 2017-09-06 09:39:16 -07:00
joeduffy d8d94d1df0 Harden error paths and improve messages 2017-09-06 09:36:28 -07:00
joeduffy f0389799d8 Convey errors if any error messages occurred 2017-09-06 09:35:35 -07:00
joeduffy 7e5b6a564c Let assets/archives contain computeds 2017-09-06 08:59:23 -07:00
joeduffy ca149316fc Block resource creations within mapValue 2017-09-06 08:49:20 -07:00
joeduffy 240b54b5be Add typings and tests for mapValues that return computeds 2017-09-06 08:28:11 -07:00
joeduffy 0f08ef3cda Improve mapValue: log errors, permit Computed<U> returns 2017-09-06 08:10:30 -07:00
joeduffy 6630de503c Support capturing Computed<T>s and Promise<T>s
This change adds support for awaiting any Computed<T> and Promise<T>s
that were captured inside of a function's closure.  This preserves our
ability to capture, for example, resource state that ends up getting
serialized as the final resource state, rather than a snapshot of the
(mostly unresolved) resource state at the time of serialization.
2017-09-06 07:36:19 -07:00
joeduffy cc9a607f01 Move environment entry serialization into JavaScript
This change moves the environment entry serialization logic into
JavaScript, where it's a bit easier to author and maintain.  We
also switch to using Object.keys, so that we only walk the enumerable
properties of objects (to avoid internal member functions and to
generally leverage our current style of writing code).  This is
just a temporary stopgap until we figure out more rigorous semantics
for what it means to serialize entire objects ...
2017-09-05 16:57:23 -07:00