0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
Commit Graph

8810 Commits

Author SHA1 Message Date
isaacs
120f7cf55f npm: upgrade to 1.4.10
* Don't set referer if already set
* fetch: Send referer and npm-session headers
* run-script: Support --parseable and --json
* list runnable scripts (Evan Lucas)
* Use marked instead of ronn for html docs
2014-05-05 18:20:40 -07:00
Fedor Indutny
00890e43fb constants: export O_NONBLOCK
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-05-02 22:54:08 +04:00
Fedor Indutny
a960d1707a deps: backport 23f2736a from v8 upstream
Original text:

    Fix corner case in x64 compare stubs.

    BUG=v8:2416

    Review URL: https://codereview.chromium.org/11413087

fix #7528
2014-05-02 22:53:27 +04:00
Timothy J Fontaine
bfe1fdb8ab Now working on 0.10.29 2014-05-02 07:46:15 -07:00
Timothy J Fontaine
d857d5ab09 Merge branch 'v0.10.28-release' into v0.10 2014-05-02 07:46:05 -07:00
Timothy J Fontaine
b148cbe09d 2014.05.01, Version 0.10.28 (Stable)
* npm: upgrade to v1.4.9
2014-05-01 17:47:47 -07:00
isaacs
dbec0a0cd8 npm: upgrade to v1.4.9
* Send referer header (with any potentially private stuff redacted)
* Fix critical typo bug in previous npm release
2014-05-01 16:30:33 -07:00
Timothy J Fontaine
1285008fca Now working on 0.10.28 2014-05-01 15:30:07 -07:00
Timothy J Fontaine
7abd826366 Merge branch 'v0.10.27-release' into v0.10 2014-05-01 15:29:52 -07:00
Timothy J Fontaine
cb7911f78a 2014.05.01, Version 0.10.27 (Stable)
* npm: upgrade to v1.4.8

* openssl: upgrade to 1.0.1g

* uv: update to v0.10.27

* dns: fix certain txt entries (Fedor Indutny)

* assert: Ensure reflexivity of deepEqual (Mike Pennisi)

* child_process: fix deadlock when sending handles (Fedor Indutny)

* child_process: fix sending handle twice (Fedor Indutny)

* crypto: do not lowercase cipher/hash names (Fedor Indutny)

* dtrace: workaround linker bug on FreeBSD (Fedor Indutny)

* http: do not emit EOF non-readable socket (Fedor Indutny)

* http: invoke createConnection when no agent (Nathan Rajlich)

* stream: remove useless check (Brian White)

* timer: don't reschedule timer bucket in a domain (Greg Brail)

* url: treat  the same as / (isaacs)

* util: format as Error if instanceof Error (Rod Vagg)
2014-05-01 14:04:20 -07:00
isaacs
f76c3938d0 npm: upgrade to v1.4.8
* Check SHA before using files from cache
* adduser: allow change of the saved password
* Make `npm install` respect `config.unicode`
* Fix lifecycle to pass `Infinity` for config env value
* Don't return 0 exit code on invalid command
* cache: Handle 404s and other HTTP errors as errors
* bump tap dep, make tests stderr a bit quieter
* Resolve ~ in path configs to env.HOME
* Include npm version in default user-agent conf
* npm init: Use ISC as default license, use save-prefix for deps
* Many test and doc fixes
2014-05-01 11:09:00 -07:00
Timothy J Fontaine
1038959dbf uv: update to v0.10.27 2014-05-01 09:27:39 -07:00
Forrest L Norvell
793c76e5c6 docs: add cautionary note to emitter.removeAllListeners
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-29 14:15:10 +04:00
Ben Noordhuis
3f3a71e61e deps: fix v8 link error with glibc < 2.17
Commit f9ced08 switches V8 on Linux over from gettimeofday() to
clock_getres() and clock_gettime().  As of glibc 2.17, those functions
live in libc.  For older versions, we need to pull them in from librt.

Fixes the following link-time error;

    Release/obj.target/deps/v8/tools/gyp/libv8_base.a(platform-posix.o):
    In function `v8::internal::OS::Ticks()':
    platform-posix.cc:(.text+0x93c):
    undefined reference to `clock_gettime'
    platform-posix.cc:(.text+0x989):
    undefined reference to `clock_getres'

Fixes #7514.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-28 19:34:07 +04:00
Rod Vagg
250782d139 util: format as Error if instanceof Error
Conflicts:
	lib/util.js
	test/simple/test-util-format.js

This is a backport to fix #7253

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-26 00:52:49 +04:00
Ben Noordhuis
f9ced08de3 deps: make v8 use CLOCK_REALTIME_COARSE
Date.now() indirectly calls gettimeofday() on Linux and that's a system
call that is extremely expensive on virtualized systems when the host
operating system has to emulate access to the hardware clock.

Case in point: output from `perf record -c 10000 -e cycles:u -g -i`
for a benchmark/http_simple bytes/8 benchmark with a light load of
50 concurrent clients:

    53.69%     node  node                 [.] v8::internal::OS::TimeCurrentMillis()
               |
               --- v8::internal::OS::TimeCurrentMillis()
                  |
                  |--99.77%-- v8::internal::Runtime_DateCurrentTime(v8::internal::Arguments, v8::internal::Isolate*)
                  |          0x23587880618e

That's right - over half of user time spent inside the V8 function that
calls gettimeofday().

Notably, nearly all system time gets attributed to acpi_pm_read(), the
kernel function that reads the ACPI power management timer:

    32.49%     node  [kernel.kallsyms]    [k] acpi_pm_read
               |
               --- acpi_pm_read
                  |
                  |--98.40%-- __getnstimeofday
                  |          getnstimeofday
                  |          |
                  |          |--71.61%-- do_gettimeofday
                  |          |          sys_gettimeofday
                  |          |          system_call_fastpath
                  |          |          0x7fffbbaf6dbc
                  |          |          |
                  |          |          |--98.72%-- v8::internal::OS::TimeCurrentMillis()

The cost of the gettimeofday() system call is normally measured in
nanoseconds but we were seeing 100 us averages and spikes >= 1000 us.
The numbers were so bad, my initial hunch was that the node process was
continuously getting rescheduled inside the system call...

v8::internal::OS::TimeCurrentMillis()'s most frequent caller is
v8::internal::Runtime_DateCurrentTime(), the V8 run-time function
that's behind Date.now().  The timeout handling logic in lib/http.js
and lib/net.js calls into lib/timers.js and that module will happily
call Date.now() hundreds or even thousands of times per second.
If you saw exports._unrefActive() show up in --prof output a lot,
now you know why.

That's why this commit makes V8 switch over to clock_gettime() on Linux.
In particular, it checks if CLOCK_REALTIME_COARSE is available and has
a resolution <= 1 ms because in that case the clock_gettime() call can
be fully serviced from the vDSO.

It speeds up the aforementioned benchmark by about 100% on the affected
systems and should go a long way toward addressing the latency issues
that StrongLoop customers have been reporting.

This patch will be upstreamed as a CR against V8 3.26.  I'm sending it
as a pull request for v0.10 first because that's what our users are
running and because the delta between 3.26 and 3.14 is too big to
reasonably back-port the patch.  I'll open a pull request for the
master branch once the CR lands upstream.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-24 14:02:05 -07:00
Julian Gruber
0ee99565f9 doc: fix missing link in net api
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-24 19:59:41 +04:00
Julian Gruber
b0fa931e07 doc: fix order in net api
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-24 19:59:41 +04:00
Fedor Indutny
4601e7c892 Revert "deps: backport b5135bbc from c-ares repo"
This reverts commit 896e19330a.

Proper handling of TXT records requires API change, we can't afford it
in v0.10.

See #7371 for details.
2014-04-24 10:19:30 +04:00
isaacs
75bc11cf12 npm: upgrade to 1.4.7
* isaacs, Robert Kowalski, Benjamin Coe: Test Improvements
* isaacs doc: Add canonical url
* isaacs view: handle unpublished packages properly
* Raynos (Jake Verbaten) do not log if silent
* Julian Gruber fix no such property error
* isaacs npmconf@0.1.14
* Thorsten Lorenz adding save-prefix configuration option
* isaacs npm-registry-client@0.4.7
* isaacs cache: treat missing versions as a 404
* isaacs cache: Save shasum, write resolved/etc data to cache
* isaacs cache: Always fetch root doc
* isaacs cache: don't repack unnecessarily from tmp
* Andrey Kislyuk Don't crash if shrinkwrap-dependencies were not passed in pkginfo
* Robert Kowalski fix link in faq
* Jean Lauliac Add a peerDependencies section in package.json doc
* isaacs read-installed@2.0.2
2014-04-15 15:31:36 -07:00
isaacs
9520adeb37 url: treat \ the same as /
See https://code.google.com/p/chromium/issues/detail?id=25916

Parse URLs with backslashes the same as web browsers, by replacing all
backslashes with forward slashes, except those that occur after the
first # character.
2014-04-15 15:30:43 -07:00
Fedor Indutny
1bd4f3a605 child_process: fix deadlock when sending handles
Fix possible deadlock, when handles are sent in both direction
simultaneously. In such rare cases, both sides may queue their
`NODE_HANDLE_ACK` replies and wait for them.

fix #7465
2014-04-14 20:15:09 +04:00
William Bert
bfb7de5e75 docs: fix links to streams
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-11 00:52:33 +04:00
Timothy J Fontaine
632c135622 src: use monotonic time for process.uptime()
`process.uptime()` interface will return the amount of time the
current process has been running. To achieve this it was caching the
`uv_uptime` value at program start, and then on the call to
`process.uptime()` returning the delta between the two values.

`uv_uptime` is defined as the number of seconds the operating system
has been up since last boot. On sunos this interface uses `kstat`s
which can be a significantly expensive operation as it requires
exclusive access, but because of the design of `process.uptime()` node
*had* to always call this on start. As a result if you had many node
processes all starting at the same time you would suffer lock
contention as they all tried to read kstats.

Instead of using `uv_uptime` to achieve this, the libuv loop already
has a concept of current loop time in the form of `uv_now()` which is
in fact monotonically increasing, and already stored directly on the
loop. By using this value at start every platform performs at least
one fewer syscall during initialization.

Since the interface to `uv_uptime` is defined as seconds, in the call
to `process.uptime()` we now `uv_update_time` get our delta, divide by
1000 to get seconds, and then convert to an `Integer`. In 0.12 we can
move back to `Number::New` instead and not lose precision.

Caveat: For some platforms `uv_uptime` reports time monotonically
increasing regardless of system hibernation, `uv_now` interface is
also monotonically increasing but may not reflect time spent in
hibernation.
2014-04-10 10:55:02 -07:00
Timothy J Fontaine
af69f88a9d build: make sure changelog.html is generated 2014-04-08 09:06:28 -07:00
Fedor Indutny
d6fd118727 deps: update openssl to 1.0.1g 2014-04-08 00:58:37 +04:00
Fedor Indutny
f2b297cc7c http: do not emit EOF non-readable socket
Socket may become not `readable`, but http should not rely on this
property and should not think that it means that no data will ever
arrive from it. In fact, it may arrive in a next tick and, since
`this.push(null)` was already called, it will result in a error like
this:

    Error: stream.push() after EOF
        at readableAddChunk (_stream_readable.js:143:15)
        at IncomingMessage.Readable.push (_stream_readable.js:123:10)
        at HTTPParser.parserOnBody (_http_common.js:132:22)
        at Socket.socketOnData (_http_client.js:277:20)
        at Socket.EventEmitter.emit (events.js:101:17)
        at Socket.Readable.read (_stream_readable.js:367:10)
        at Socket.socketCloseListener (_http_client.js:196:10)
        at Socket.EventEmitter.emit (events.js:123:20)
        at TCP.close (net.js:479:12)

fix #6784
2014-04-08 00:40:22 +04:00
Brian White
c2d32f4c0e doc: add missing space
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-07 17:45:04 +04:00
Dominic Tarr
cdc093b31f docs: correct tls docs. server -> client
when a pfx file is passed to tls.connection,
it is the client private key, not the server's private key.
2014-04-02 15:34:16 +04:00
Goh Yisheng (Andrew)
47bed4828c doc: typo clean up in tls 2014-03-31 07:40:17 -07:00
Josh Dague
a9d22247ad build: windows signing should include timestamps
Previously the build artifacts did not include a signed timestamp, so
when the certificate expired the validation of the artifact would fail.
Now we sign against a timestamp server such that the artifact will
always be valid regardless of the disposition of the certificate.

Closes #7360 and #7059.
2014-03-27 11:54:13 -07:00
Ben Noordhuis
f68a116c3c src: ensure that openssl's PRNG is fully seeded
Ensure that OpenSSL has enough entropy (at least 256 bits) for its PRNG.

The entropy pool starts out empty and needs to fill up before the PRNG
can be used securely.

OpenSSL normally fills the pool automatically but not when someone
starts generating random numbers before the pool is full: in that case
OpenSSL keeps lowering the entropy estimate to thwart attackers trying
to guess the initial state of the PRNG.

When that happens, we wait until enough entropy is available, something
that normally should never take longer than a few milliseconds.

Fixes #7338.
2014-03-26 11:31:32 +04:00
Ben Noordhuis
70f198ddb1 src: seed V8's random number generator at startup
The default entropy source is /dev/urandom on UNIX platforms, which is
okay but we can do better by seeding it from OpenSSL's entropy pool.

On Windows we can certainly do better; on that platform, V8 seeds the
random number generator using only the current system time.

Fixes #6250.

NB: This is a back-port of commit 7ac2391 from the master branch that
for some reason never got back-ported to the v0.10 branch.

The default on UNIX platforms in v0.10 is different and arguably worse
than it is with master: if no entropy source is provided, V8 3.14 calls
srandom() with a xor of the PID and the current time in microseconds.

That means that on systems with a coarse system clock, the initial
state of the PRNG may be easily guessable.

The situation on Windows is even more dire because there the PRNG is
seeded with only the current time... in milliseconds.
2014-03-26 11:31:32 +04:00
isaacs
bd547d6598 npm: upgrade to 1.4.6
* Documentation upgrades
* Fix glob bug which prevents proper README publishing
* node-gyp upgrade to 0.13
* Documentation updates
* Add --save-exact to save an exact dep (instead of a range)
* alias 't' to 'test'
2014-03-25 17:42:22 -07:00
Ben Noordhuis
7989f42f86 build: fix g++ 4.8 build, disable -Werror
Turn off -Werror when building V8, it hits -Werror=unused-local-typedefs
with g++ 4.8.  The warning itself is harmless so don't abort the build.

This was originally implemented in commit d2ab314e back in 2011 but the
build process has gone through a few iterations since then, that change
no longer works.
2014-03-23 16:11:08 -07:00
Shuhei Kagawa
43a29f53ca doc: remove an unused arg in process.stdin.
The argument of process.stdin's readable event handler is not used.
2014-03-10 15:30:40 -07:00
Fedor Indutny
f0d870501e crypto: do not lowercase cipher/hash names
`crypto.getCiphers()` and `crypto.getHashes()` should prefer lower-case
variants of names, but should not introduce them.

fix #7282
2014-03-11 01:08:43 +04:00
Ben Noordhuis
6bd78fd770 deps: fix v8 valgrind warning
Fix the following valgrind warning:

    Conditional jump or move depends on uninitialised value(s)
        at 0x7D64E7: v8::internal::GlobalHandles::IterateAllRootsWithClassIds(v8::internal::ObjectVisitor*) (global-handles.cc:613)
        by 0x94DCDC: v8::internal::NativeObjectsExplorer::FillRetainedObjects() (profile-generator.cc:2849)
        # etc.

This was fixed upstream in r12903 and released in 3.15.2 but that commit
was never back-ported to the 3.14 branch that node.js v0.10 uses.

The code itself works okay; this commit simply shuffles the clauses in
an `if` statement to check that the node is in use before checking its
class id (which is uninitialized if the node is not in use.)
2014-03-07 03:29:00 +04:00
Fedor Indutny
5e06ce4fb9 child_process: fix sending handle twice
When sending a socket to a child process via IPC pipe,
`child_process.js` picks a raw UV handle from `_handle` property, sends
it, and assigns `null` to the property. Sending the same socket twice
was resulting in a runtime error, since we weren't handling the empty
`_handle` case.

In case of `null` `_handle` we should send just a plain text message
as passed it was passed to `.send()` and ignore the handle, letting
users handle such cases themselves instead of throwing the error at
runtime.

fix #5469
2014-03-05 09:36:35 -08:00
Benoit Vallée
a9d24fa40d test: test sending a handle twice
Added test-cluster-send-handle-twice.js testing to send a handle
twice to the parent process.
2014-03-05 09:36:32 -08:00
Ben Noordhuis
bd8a5755dc src: add default visibility to NODE_MODULE
It's currently not really possible to compile native add-ons with
-fvisibility=hidden because that also hides the struct containing
the module definition.

The NODE_MODULE() and NODE_MODULE_DECL() macros are structured in
a way that makes it impossible to add a visibility attribute manually
so there is no escape hatch there.

That's why this commit adds an explicit visibility attribute to
the module definition.  It doesn't help with node.js releases that
are already out there but at least it improves the situation going
forward.
2014-03-05 15:26:09 +04:00
Greg Brail
6eb4d1d15c timer: don't reschedule timer bucket in a domain
If two timers run on the same tick, and the first timer uses a domain,
and then catches an exception and disposes of the domain, then the
second timer never runs. (And even if the first timer does not dispose
of the domain, the second timer could run under the wrong domain.)

This happens because timer.js uses "process.nextTick()" to schedule
continued processing of the timers for that tick. However, there was
an exception inside a domain, then "process.nextTick()" runs under
the domain of the first timer function, and will do nothing if
the domain has been disposed.

To avoid this, we temporarily save the value of "process.domain"
before calling nextTick so that it does not run inside any domain.
2014-03-03 17:46:49 -08:00
Timothy J Fontaine
06453a94a7 src: domain should not replace nextTick function
Previously if you cached process.nextTick and then require('domain')
subsequent nextTick() calls would not be caught because enqueued
functions were taking the wrong path. This keeps nextTick to a single
function reference and changes the implementation details after domain
has been required.
2014-03-03 16:27:58 -08:00
Nathan Rajlich
47abdd9c43 test: add agent: null http client request test
This is just the test portion from #7012 / #7189,
but targetted for the v0.10 branch.
2014-02-26 11:39:53 -08:00
Nathan Rajlich
0a01a42e87 http: invoke createConnection when no agent
This makes it so that the user may pass in a
`createConnection()` option, and they don't have
to pass `agent: false` at the same time.

Also adding a test for the `createConnection` option,
since none was in place before.

See #7014.
2014-02-26 11:14:32 -08:00
Mike Pennisi
aae51ecf7d assert: Ensure reflexivity of deepEqual
Ensure that the behavior of `assert.deepEqual` does not depend on
argument ordering  when comparing an `arguments` object with a
non-`arguments` object.
2014-02-25 20:32:49 +04:00
Brian White
70ea5bac43 stream: remove useless check 2014-02-24 15:08:11 +04:00
Nicolas Talle
1efe6837b2 doc: update assert.markdown
Update assert.throws() and assert.doesNotThrow() docs
2014-02-23 18:09:26 +04:00
Fedor Indutny
e0c5302590 installer: copy node.d only with node_use_dtrace 2014-02-21 01:03:03 +04:00
Fedor Indutny
a6f89ccd76 dtrace: workaround linker bug on FreeBSD 2014-02-21 00:56:17 +04:00