Commit Graph

708 Commits

Author SHA1 Message Date
Martín Bigio c1c61a4e88 defeat race condition when replying to client
Summary: @​public

The server dies after 30 seconds if it has no jobs on it's queue. The problem is that the jobs counter gets decreased before returning the bytes to the client. As a consequence, it's possible that the server dies while it's returning the bytes to the client, or just after it finished returning the bytes to the client.

To avoid both issues lets move the counter decrease a few lines below and bump the timer to make sure we have time to fully write the bytes on the socket and let the client close the connection before the server dies.

Reviewed By: @vjeux

Differential Revision: D2445264
2015-09-15 16:25:25 -07:00
Peter Cottle c4c36116cf Fix various issues with packager editor launcher
Summary: There are a few small bugs with the code that launches the editor from the packager:

* First of all, the filepath is not escaped which means tokens like `(` or spaces will mess up the process execution. Dropbox unfortunately decided to use spaces in its enterprise product, so I was getting this error:

![screen shot 2015-07-11 at 3 20 54 pm](https://cloud.githubusercontent.com/assets/1135007/8635748/186e7f2e-27ea-11e5-8058-1f4dabb79634.png)

* Next, the line number argument formatting was assumed to be in a specific format (`:%d`) which actually errors out vim and other editors.
* Lastly, the process was started synchronously but not attached to the stdin / stdout of the parent process. This means that only editors like mvim, sublime, and others would work since they spawn a new window. Editors like emacs, vi, nano, etc wouldn't work and instead just hang at the command line.

So I whipped up this diff to fix a number of these issues, demo here:
http://recordit.co/M6zwiUj7hp

The demo shows both
Closes https://github.com/facebook/react-native/pull/1957

Reviewed By: @vjeux, @pcottle

Differential Revision: D2420941

Pulled By: @frantic
2015-09-14 10:00:26 -07:00
Martin Konicek 50dbbe5af2 Fix blacklist
Reviewed By: @amasad

Differential Revision: D2432196
2015-09-11 17:01:43 -07:00
Amjad Masad 86a099d00a Refactor DependencyResolver into request/response
Reviewed By: @martinbigio

Differential Revision: D2425842
2015-09-11 17:01:35 -07:00
Christopher Chedeau 87d4d3c55c Revert internal files that didn't get pulled internally first
See all the packager files in this commit:
f83675d191 (diff-7b5603771e245e5b0cd7223277db3db4)

cc @foghina
2015-09-11 16:59:28 -07:00
Amjad Masad 676c1c3a45 Fix server tests
Summary: @​public
Invoking an extra promise caused failures in the promise-based tests. This fixes them.

Reviewed By: @vjeux

Differential Revision: D2432431
2015-09-11 13:30:33 -07:00
Tadeu Zagallo 270b1c718f Automatically save and convert JavaScript profile to chrome format
Summary: @​public

Migrate scripts to open source and add new route on the packager
to directly convert profiler outputs to a devtools compatible format.

Reviewed By: @jspahrsummers

Differential Revision: D2425740
2015-09-11 06:40:26 -07:00
Amjad Masad 2c321df75c Client should throw when server unexpectedly closes the connection
Reviewed By: @natthu

Differential Revision: D2425357
2015-09-09 16:35:25 -07:00
Amjad Masad b8209572bb Handle EEXIST error when starting the server
Reviewed By: @cpojer

Differential Revision: D2426373
2015-09-09 16:10:33 -07:00
Amjad Masad c308774bc1 Protect against races in deleting corrupt cache
Reviewed By: @cpojer

Differential Revision: D2426450
2015-09-09 16:05:39 -07:00
Amjad Masad 68fb275c78 Pass in platform argument in offline building
Summary: how did this ever work?
All build jobs must pass in the platform argument.
This also turns the "platform" argument into a required one.

I added a task to infer the platform argument from the filename here: t8306875

Reviewed By: @martinbigio

Differential Revision: D2425114
2015-09-09 14:45:58 -07:00
Christopher Chedeau ef080b699d Fix declareOpts test
Summary: When we updated joi, the error message was changed. I removed the content to prevent similar errors in the future.

Reviewed By: @amasad

Differential Revision: D2424048
2015-09-09 11:25:28 -07:00
Tadeu Zagallo 91e235465b Move systrace helper out of the packager
Summary: @​public

The profiler helper shouldn't live inside the packager itself, move
it to the packager.js file with other middlewares.

Reviewed By: @martinbigio

Differential Revision: D2424878
2015-09-09 11:25:24 -07:00
Christopher Chedeau b59784573b Revert "unbreak tests"
This reverts commit f9b2709c8d39b1ec6f729d315855f05d427ab75b.
2015-09-09 11:10:50 -07:00
Christopher Chedeau 086adda39b unbreak tests 2015-09-08 20:00:42 -07:00
Christopher Chedeau 1a428c2c90 Updates from Tue 8 Sep 2015-09-08 16:54:44 -07:00
Alex Kotliarskyi 802578a78e [ReactNative] Pipe `platform` option all the way to the asset server 2015-09-08 11:37:38 -08:00
Ben Alpert 47eec251bc [ReactNative] Enable displayName transformer in open source 2015-09-08 08:11:42 -08:00
Martín Bigio 7beb248c06 [react-packager] Bump ipc timeout 2015-09-08 04:50:25 -08:00
Amjad Masad 2727f4b5ea [react-packager] Allow a longer startup time before the server dies
Summary:
1. When the server starts up, it only gives itself 30 second to live before receiving any connections/jobs
2. There is a startup cost with starting the server and handshaking
3. The server dies before the client has a chance to connect to it

Solution:
1. While the server should die pretty fast after it's done it's work, we should have a longer timeout for starting it
2. I also added accompanying server logs with client connection errors
2015-09-07 10:31:49 -08:00
Martín Bigio 4b14a2f783 [react-packager] Add command line option to reset cache on OSS 2015-09-07 01:16:44 -08:00
Amjad Masad b7d76074a0 [react-packager] Support platform extensions in image requires
Summary:
We don't currently support platform extensions in asset modules.
This adds supports for it:

```
require('./a.png');
```

Will require 'a.ios.png' if it exists and 'a.png' if it doesn't.
2015-09-04 15:17:14 -08:00
Tadeu Zagallo 79abdb2250 [RectNative][Packager] Cache minification result
Summary:
The packager just cached the result of the bundle, but would minify
it on every request. Change it to cache the minification result.
2015-09-04 12:22:50 -08:00
Amjad Masad 734edf5cd4 [react-packager] Socket Server should not die while there active connections
Summary:
Saw an issue with a build because of an ENONT error: https://fb.facebook.com/groups/716936458354972/permalink/923628747685741/

My hypothesis:

1. We issue a ping to the socket (in SocketInterface/index.js) a decides if the available socket is alive
2. We see that it's alive but by the time we actually connect to it the server would've died

Solution:

1. The server shouldn't die as long as there are clients connected to it (currently it only stay alive as long as there are jobs)
2. The "ping" should only disconnect once the client is connected
3. Finally, have a better error message than ENOENT
2015-09-03 14:48:19 -08:00
Tadeu Zagallo bcbe99b3af [ReactNative][Packager] Fix source maps for minified sources
Summary:
The packager was ignoring minification for source map requests.
2015-09-03 12:01:57 -08:00
Spencer Ahrens bad0a5cb46 Updates from Thu Sep 3rd. 2015-09-03 12:55:40 -07:00
Amjad Masad 672b7b0070 [react-packager] Sourcemap url should include the same args as the bundle url
Summary:
Sourcemap urls were generated as just the pathname (no options) which meant that they generated source for the wrong bundle.

Even worse, there exists a race condition when multiple request to the same bundle has different types of paltform arguments (in this case one could be 'ios' and the other is undefined). The fix will this will come later as it's more involved -- will need to refactor the dependency resolver to have a per-request state.
2015-09-02 15:34:54 -08:00
Amjad Masad c48ce25de6 [react-packager] Fix cache issues 2015-09-01 16:43:17 -08:00
Amjad Masad f9b1658c6f [react-pacakger] Max idle time for socket server is too long 2015-09-01 11:40:47 -08:00
Spencer Ahrens 0621018da6 Updates from Mon Aug 31st. 2015-08-31 16:31:41 -07:00
Amjad Masad c980942899 [react-pacakger] Fix failing test
Summary:
Fix failing test that matches the exact error string to match using `contains`.

I was under the impression that jest tests were running in CI -- turns out not yet.
2015-08-31 12:42:29 -08:00
James Ide 26a028e98d [RN Debugger] Don't try to handle messages without a method
Summary:
Some messages are special and are intended for the devtools, like `{$open: id}` and `{$error: id}`. The main debugger-ui page can't handle these and thinks something is wrong when `object.method` is undefined. This diff handles messages only if they specify a method.

Fixes #2377

Closes https://github.com/facebook/react-native/pull/2405
Github Author: James Ide <ide@jameside.com>
2015-08-31 11:09:57 -08:00
Amjad Masad 217f12a08f [react-packager] Fail loudly with errors from the transformer 2015-08-31 09:27:26 -08:00
Martín Bigio b617c43a03 [react-packager] Cache BundlesLayout 2015-08-31 07:13:35 -08:00
Martín Bigio 42ee9b1ca6 [react-packager] `System.import` transform 2015-08-27 09:28:48 -08:00
Amjad Masad 3c3af9c609 [react-packager] Fix races
Summary:
A few potential races to fix:

1. Multiple clients maybe racing to delete a zombie socket
2. Servers who should die because other servers are already listening are taking the socket with them (move `process.on('exit'` code to after the server is listening
3. Servers which are redundant should immediatly die
2015-08-27 01:41:11 -08:00
Amjad Masad 1892f4aba4 [react-packager] bump create server timeout to 60s 2015-08-26 23:11:44 -08:00
Alex Kotliarskyi a5e6cc568b [react-native] Fix tests and re-enable CI 2015-08-26 20:58:24 -08:00
Martín Bigio 971b70d72f [react-packager] Make sure server is listening on socket 2015-08-26 16:25:17 -08:00
Martin Konicek 8b317dc05c Updates from Wed 26 Aug 2015-08-26 14:04:01 +01:00
Felix Oghină dbdf7f366f [reactnative] remove platform option from oss packager 2015-08-26 04:49:41 -08:00
Amjad Masad 84f498cd2b [react-packager] Cleanup socket interface code 2015-08-25 17:36:08 -08:00
Amjad Masad 782aafd16a [react-native] bump create server timeout 2015-08-25 17:13:13 -08:00
Martin Konicek ecc89a8383 Add chalk mock 2015-08-25 22:02:19 +01:00
Martin Konicek 39681a6649 Updates from Tue 25 Aug 2015-08-25 19:21:59 +01:00
Martin Konicek fc90a2de9a [ReactNative] Unbreak OSS packager JS tests 2015-08-25 10:18:39 -08:00
Natansh Verma 5cf5ecc319 Revert "[packager] Unbreak Bundler test" 2015-08-25 09:53:45 -08:00
Amjad Masad 54125e524a [react-packager] Expose a socket interface
Summary:
Buck (our build system) currently starts multiple packager instances for each target and may build multiple targets in parallel. This means we're paying startup costs and are duplicating the work. This enables us to start one instance of the packager and connect to it via socket to do all the work that needs to be done.

The way this is structured:

1. SocketServer: A server that listens on a socket path that is generated based on the server options
2. SocketClient: Interfaces with the server and exposes the operations that we support as methods
3. SocketInterface: Integration point and responsible for forking off the server
2015-08-25 09:37:08 -08:00
Martin Konicek 81d5a70806 [packager] Unbreak Bundler test 2015-08-25 09:24:42 -08:00
Krzysztof Magiera c4f5334e92 [ReactNative] Respect --assets-dest in "download from server" mode 2015-08-25 07:22:05 -08:00