The server sends hot code push updates to mobile clients with ROOT_URL
and DDP_DEFAULT_CONNECTION_URL taken from the MOBILE_ROOT_URL and
MOBILE_DDP_URL environment variables. These are set by the main meteor
process when it starts the app runner.
Summary:
The `node-inspector` NPM package was added to the dev_bundle by this
recent commit: 64a624ae5c
Task: https://app.asana.com/0/15750483766338/16241466809965
Test Plan:
Add `debugger` statements to server code, run `meteor debug`, visit the
node-inspector URL in a browser, continue the application, and verify that
the debugger stops at the `debugger` statements that were set.
Reviewers: nim, slava, emily, avital, dgreenspan
CC: sashko
Differential Revision: https://phabricator.meteor.com/D827
If you pass "--parent-pid foobar", then we immediately log an error
message and exit. This check happens via `parseInt` rather than testing
for exceptions in `process.kill(parentPid, 0)` because `process.kill`
converts its pid argument to an integer, so `process.kill('foobar', 0)`
returns true just as `process.kill(0, 0)` does.
Downsides:
* Doesn't catch the case where the parent is CPU-hogging (but maybe we
don't want to catch that case anyway, since the bundler not yielding
is what's causing #2536).
* Could be fooled by pid re-use, i.e. if another process comes up and
takes the parent process's place before the child process dies.
Untested so far because I haven't been able to actually kill a parent
process in such a way that the child stays alive.
Using the method instead of process.kill means that we don't send the
signal if we already know the process is dead and that we don't throw on
ESRCH (ie, the kernel telling us the process is gone). (If the process
has already died we will soon get around to doing a different kind of
restart.)
Fixes#2550.
There was a race condition between the bundle process and when we established
the client watch set. We now store the future for the old bundle process so
that it cannot be invalidated.
We're going to make uniload use a different flavor of "complete" catalog
soon. So we need to reduce the number of singleton-ish references to
it.
Also, we need one PackageCache per catalog, so stop it from being a
singleton too.
Also eliminated arguments that weren't used anywhere,
and removed an XXX comment that was false (recordPackages
doesn't use buildmessage to report connection failures)
Many of these (mostly in top level commands in commands-packages.js) are
not super well thought out: they use a new "doOrDie" helper to run some
function in a capture and exit if there are any messages. We really
need to get a little more thoughtful about the big picture of error
handling (combining "build" errors, network errors, catalog errors,
etc). But this at least allows the addition of more buildmessage
assertions.
At the very least, this ensures that if you edit a package.js in a local
package while "meteor run" is running, that instead of crashing the tool
it properly shows the buildmessage and lets you fix the issue.
This fixes the test failure of the 'run' from checkout. (It would be
nice if we weren't slowing down the rebuild in 0.9.0, but at least we
should ensure that this feature survives.)
Regression introduced by the CSS watching code (specifically, f230eba62)
by the sourceIsWatched check. We need to be able to tell the difference
between "source handler didn't do anything because there was an error"
and "source handler didn't do anything because it's web-specific and
this is an os arch".
A simple fix would have been to interpret compileStep.error as
"sourceIsWatched = true", but I didn't think of that until after doing
it the slightly more complicated but more precise way :)
Also, ensure that if the runner rebuilds the client and there's an
error, it properly kills the app process (and the watchers and the
keepalive interval, etc).
Port a simplified version of Meteor.EnvironmentVariable and
Meteor.bindEnvironment to fiber-helpers.js to deal with this.
Identify uses of fiberHelpers.inFiber and switch them to either
fiberHelpers.bindEnvironment (if the callback they are wrapping is
semantically "part of" the context that creates the callback) or
fiberHelpers.inBareFiber (otherwise).
Without this, concurrency was causing the wrong buildmessage message
sets and jobs to be active when builds yielded.
Moving towards a world where all things that might invoke buildmessage.error are
encouraged to be in a buildmessage.capture.
This commit is the answer to the question "how many small changes need to be
made to add buildmessage.assertInCapture to PackageCache.loadPackageAtPath?"
Next steps include:
- Making catalog.resolveConstraints ALWAYS buildmessage.assertInCapture
(not just when ignoreProjectDeps isn't passed)
- Then changing resolveConstraints to complain using buildmessage
- Removing the process.exit(1) in _ensureDepsUpToDate
- Adding a more structured way to ensure that most commands
call _ensureDepsUpToDate at an unsurprising location
We were overwriting the server directory when a client-side file changed,
which made all process calls fail, such as process.cwd() and fs.*. We
abstracted out some of the builder code so that only the client targets
are "rebuilt" when a client side file changes.
symlink as a special case for runner only
future commits on this branch will add a
package.json/npm-shrinkwrap.json that can be used by "meteor bundle"
users
Before this, if the runner decided to stop (eg, because mongod is
crashing too much) while waiting for file change, it would crash due to
an attempt to wait within a fiber. Fixing that bug by adding an inFiber
would then lead to the process just not exiting, because nothing stops
the wait-specific future.
Doing so reveals a deadlock in the stop code (which causes self-test to
fail, yay). Fix it by trying harder to not stop the (all or app) runner
until after the app runner has processed the "hey you should stop"
return false from onRunEnd.
If you happen to introduce a circular require into the stack, this
object will be undefined.
Instead, hang on to `require('./run-log.js')`, which is the exports
module which does get filled in later.