Add documentation for the callback parameter of http.ClientRequest's and
http.ServerResponse's end methods.
Signed-off-by: Julien Gilli <julien.gilli@joyent.com>
Currently clearBreakpoint error is confusing, it says "Script not found"
when there is no breakpoint, also documentation doesn't include
signature for clearBreakpoint.
PR-URL: https://github.com/iojs/io.js/pull/175
Reviewed-By: Miroslav Bajtoš <miroslav@strongloop.com>
Add documentation for the callback parameter of http.ClientRequest's and
http.ServerResponse's end methods.
PR-URL: https://github.com/iojs/io.js/pull/181
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Brendan Ashworth <squirrelslikeacorns@gmail.com>
Remove the 'gc' event from the v8 module and remove the supporting
infrastructure from src/. It gets the axe because:
1. There are currently no users. It was originally conceived as
an upstreamed subset of StrongLoop's strong-agent GC metrics,
but the strong-agent code base has evolved considerably since
that time and has no use anymore for what is in core.
2. The implementation is not quite sound. It calls into JS land
from inside the GC epilog and that is unsafe. We could fix
that by delaying the callback until a safe time but because
there are no users anyway, removing it is all around easier.
PR-URL: https://github.com/iojs/io.js/pull/174
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
In cases where many small writes are made to a stream
lacking _writev, the array data structure backing the
WriteReq buffer would greatly increase GC pressure.
Specifically, in the fs.WriteStream case, the
clearBuffer routine would only clear a single WriteReq
from the buffer before exiting, but would cause the
entire backing array to be GC'd. Switching to [].shift
lessened pressure, but still the bulk of the time was
spent in memcpy.
This replaces that structure with a linked list-backed
queue so that adding and removing from the queue is O(1).
In the _writev case, collecting the buffer requires an
O(N) loop over the buffer, but that was already being
performed to collect callbacks, so slowdown should be
neglible.
PR-URL: https://github.com/joyent/node/pull/8826
Reviewed-by: Timothy J Fontaine <tjfontaine@gmail.com>
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Fixes the following assertion on slow systems, like our ARM buildbot:
$ out/Debug/node test/simple/test-timers-unref.js
node: ../src/async-wrap-inl.h:101: v8::Handle<v8::Value>
node::AsyncWrap::MakeCallback(uint32_t, int,
v8::Handle<v8::Value>*): Assertion `cb_v->IsFunction()' failed.
Aborted
The reason it only manifests on slow systems is that the test starts
a 1 ms interval timer, then defers timer.unref.bind({}) to the next
tick. On fast systems, the test completes in under a millisecond,
before the callback is called.
This commit makes timer.unref() check that the receiver actually has
a timeout callback property.
Fixes#13.
PR-URL: https://github.com/iojs/io.js/pull/165
Reviewed-By: Rod Vagg <rod@vagg.org>
Fix a Windows-only build error that was introduced in
commit 1183ba4 ("zlib: support concatenated gzip files").
Rename the NO_ERROR and FAILED enumerations, they conflict
with macros of the same name in <winerror.h>.
PR-URL: https://github.com/joyent/node/pull/8893
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-by: Timothy J Fontaine <tjfontaine@gmail.com>
Fix Interface.setBreakpoint() to correctly handle an attempt to set a
breakpoint in the current script when there is no current script.
This usually happens when the debugged process is not paused.
Fixes: https://github.com/joyent/node/issues/6453
PR-URL: https://github.com/joyent/node/pull/6460
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
* Allow running tests in mixed parallel/sequential modes
* Add -J flag for running tests on all available CPUs
* Support TEST_THREAD_ID in test/common.js and use it for tmpDir and PORT
* make: use -J flag
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: https://github.com/iojs/io.js/pull/172Fix: iojs/io.js#139
fs.exists() and fs.existsSync() do not follow the typical
error first callback convention. access() and accessSync()
are added as alternatives in this commit.
Fixes: https://github.com/joyent/node/pull/8714
PR-URL: https://github.com/iojs/io.js/pull/114
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Domenic Denicola <domenic@domenicdenicola.com>
Currently there's an example using http.ServerResponse stream, which
has a known bug and will not throw an error while writing after end().
Changed to a writable stream from fs which behaves as expected.
Fixes https://github.com/joyent/node/issues/8814.
PR-URL: https://github.com/iojs/io.js/pull/155
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Brendan Ashworth <squirrelslikeacorns@gmail.com>
I introduced this module over a year ago in a pull request as the v8
module but it was quickly subsumed by the tracing module.
The tracing module was recently removed again and that is why this
commit introduces the v8 module again, including the new features it
picked up commits d23ac0e and f8076c4.
PR-URL: https://github.com/iojs/io.js/pull/131
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Christian Tellnes <christian@tellnes.no>
Reviewed-By: Thorsten Lorenz <thlorenz@gmx.de>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Move the big endian to little endian conversion logic for UCS2 input
from src/string_bytes.cc to src/node_buffer.cc; StringSlice() is the
only function that actually needs it and with this commit, a second
copy is avoided on big endian architectures.
Introduce two-byte overloads of node::Encode() and StringBytes::Encode()
that ensure that the input is suitably aligned.
Revisits commit 535fec8 from yesterday.
Fix a regression that was introduced in commit a38b9178 by removing the
bad check. Also rearrange the addon loading logic to ensure that the
list of pending addons remains in a consistent state when the shared
object fails to load; in particular, when an addon self-registers first,
then hits a dynamic linker error in a later constructor.
Fixes the following asserting when loading a .node shared object:
node: ../src/node.cc:1944: void node::node_module_register(void*):
Assertion `(modpending) != (nullptr)' failed.
Fixesstrongloop/strongops#233.
PR-URL: https://github.com/iojs/io.js/pull/154
Reviewed-By: Ryan Graham <ryan@strongloop.com>
Per the TC meeting on 2014-12-10, domains will be "soft deprecated"
until a suitable replacement API is available; at which time they
will be fully deprecated. Full deprecation will include references
to replacement API and the application of util.deprecate to the domain
api.
PR-URL: https://github.com/iojs/io.js/pull/141
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Adds the feature to define arguments for the function called in
domain.run(), this is supposed to be useful when a function is called from
another context and some values from the current context are needed as
arguments, it's similar to the callback from setTimeout or setInterval.
PR-URL: https://github.com/iojs/io.js/pull/15
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Fixes regression in require system that prevented loading relative
packages via main property in package.json where the file is not
index.{ext}. The regression was introduced in commit 36777d2.
PR-URL: https://github.com/iojs/io.js/pull/145
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Commit 691d55f introduces a regression on OS X when dtrace is enabled
(the default.) This commit rectifies that by removing the erroneous
platform check.
Fixes the following build error:
CXX(target) /Users/bnoordhuis/src/iojs/out/Release/obj.target/node/src/node_dtrace.o
../src/node_dtrace.cc:27:10: fatal error: 'node_provider.h' file not found
PR-URL: https://github.com/iojs/io.js/pull/150
Reviewed-By: Miroslav Bajtoš <miro.bajtos@gmail.com>
Rewords project messaging in README to make the overall project
messaging a bit clearer. More discussion to be found in iojs/io.js#24.
PR-URL: https://github.com/iojs/io.js/pull/36
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
Previously, 'configure' would not return an exit status
if gyp blows up. This can be tested via:
date >> node.gyp ; ./configure && echo A-OK
You will get "A-OK" even though gyp had failed.
PR-URL: https://github.com/joyent/node/pull/8856
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
In newly introduced `SafeX509ExtPrint` I forgot to insert separators
between extensions, which lead to the "DNS:...DNS:..." thing for npm.
Fix: iojs/io.js#105
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: https://github.com/iojs/io.js/pull/113.patch
Some distributions disable SSLv3 due to POODLE. In such a case, disable
the specific SSLv3 methods and throw an exception, much like the code
already does for SSLv2. The SSLv23* code is retained because this is
OpenSSL's terminology for "no version in particular".
Reviewed-By: Fedor Indutny <fedor@indutny.com>
PR-URL: https://github.com/iojs/io.js/pull/101
Based on the ad-hoc benchmark from joyent/node#8638 plus an additional
benchmark for user:pass auth URLs.
PR-URL: https://github.com/iojs/io.js/pull/102
Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>
Remove a speed bump from commit 36777d2 by reusing the result of the
previous stat() system call. It's a code path that gets called many
thousands of times at startup in most applications so shaving off an
extra system call can have an appreciable impact on startup times.
PR-URL: https://github.com/iojs/io.js/pull/130
Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>
Dtrace probes were removed from libuv recently, but their usage by node
was not completely removed, causing build breaks on SmartOS.
Even though the build is working on other platforms, these probes are
not fired by libuv anymore, so there's no point in using them on these
platforms too.
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Seen with g++ 4.9.2 on x86_64 Linux: a SIGSEGV is generated when the
input to v8::String::NewFromTwoByte() is not suitably aligned.
g++ 4.9.2 emits SSE instructions for copy loops. That requires aligned
input but that was something StringBytes::Encode() did not enforce until
now. Make a properly aligned copy before handing off the input to V8.
We could, as an optimization, check that the pointer is aligned on a
two-byte boundary but that is technically still UB; pointers-to-char
are allowed to alias other pointers but the reverse is not true:
a pointer-to-uint16_t that aliases a pointer-to-char is in violation
of the pointer aliasing rules.
See https://code.google.com/p/v8/issues/detail?id=3694
Fixes segfaulting test simple/test-stream2-writable.
PR-URL: https://github.com/iojs/io.js/pull/127
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* The test no longer relies on being invoked from a particular
working directory to function properly.
* fs.symlink() and fs.symlinkSync() are both tested.
* The test now cleans up after itself.
This commit fixes https://github.com/iojs/io.js/issues/126
PR-URL: https://github.com/iojs/io.js/pull/129
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
The "dtrace" script version include in systemtap-sdt-devel-2.6-3
(part of Fedora 21) no longer ignores unknown command line
arguments, but will instead error out and refuse to run.
This patch adds a separate condition to node's gyp input so
that on Linux it will run dtrace without the -xnolibs
argument that trips it up on systemtap-std-devel-2.6-3.
PR-URL: https://github.com/joyent/node/pull/8846
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This merge is effectively a no-op because io.js has already
cherry-picked all the patches from node it needs.
The merge commit serves to establish a new merge base for future merges.
Call a user-defined callback at specific points in the lifetime of an
asynchronous event. Which are on instantiation, just before/after the
callback has been run.
**If any of these callbacks throws an exception, there is no forgiveness
or recovery. A message will be displayed and a core file dumped.**
Currently these only tie into AsyncWrap, meaning no call to a hook
callback will be made for timers or process.nextTick() events. Though
those will be added in a future commit.
Here are a few notes on how to make the hooks work:
- The "this" of all event hook callbacks is the request object.
- The zero field (kCallInitHook) of the flags object passed to
setupHooks() must be set != 0 before the init callback will be called.
- kCallInitHook only affects the calling of the init callback. If the
request object has been run through the create callback it will always
run the before/after callbacks. Regardless of kCallInitHook.
- In the init callback the property "_asyncQueue" must be attached to
the request object. e.g.
function initHook() {
this._asyncQueue = {};
}
- DO NOT inspect the properties of the object in the init callback.
Since the object is in the middle of being instantiated there are some
cases when a getter is not complete, and doing so will cause Node to
crash.
PR-URL: https://github.com/joyent/node/pull/8110
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Fedor Indutny <fedor@indutny.com>
Reviewed-by: Alexis Campailla <alexis@janeasystems.com>
Reviewed-by: Julien Gilli <julien.gilli@joyent.com>
When instantiating a new AsyncWrap allow the parent AsyncWrap to be
passed. This is useful for cases like TCP incoming connections, so the
connection can be tied to the server receiving the connection.
Because the current architecture instantiates the *Wrap inside a
v8::FunctionCallback, the parent pointer is currently wrapped inside a
new v8::External every time and passed as an argument. This adds ~80ns
to instantiation time.
A future optimization would be to add the v8::External as the data field
when creating the v8::FunctionTemplate, change the pointer just before
making the call then NULL'ing it out afterwards. This adds enough code
complexity that it will not be attempted until the current approach
demonstrates it is a bottle neck.
PR-URL: https://github.com/joyent/node/pull/8110
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Fedor Indutny <fedor@indutny.com>
Reviewed-by: Alexis Campailla <alexis@janeasystems.com>
Reviewed-by: Julien Gilli <julien.gilli@joyent.com>