Commit Graph

2208 Commits

Author SHA1 Message Date
Bert Belder
c5d570ddba unix: fix assert on signal pipe overflow
An incorrect assert() statement was causing libuv to crash when writing
to an internal signal pipe would result in EAGAIN/EWOULDBLOCK.

This commit doesn't solve the underlying issue that the signal pipe can
overflow.

This should fix joyent/node#5538
2013-05-23 14:44:45 +02:00
Ben Noordhuis
c53fe81544 unix: implicitly signal write errors to libuv user
Fix an infinite loop in the example below when the stream encounters
an EPIPE/ECONNRESET/etc. error:

    // keep writing until we start buffering
    while (stream->write_queue_size == 0) {
      uv_write_t* req = make_write_req();
      uv_buf_t buf = uv_buf_init("PING", 4);
      uv_write(req, stream, &buf, 1, write_cb);
    }

uv_write() does not return an error code on write errors, the error is
only reported to the callback.

Before this commit, uv_write() left stream->write_queue_size untouched
on error, meaning the caller had no way to find out about that error
until the next tick of the event loop - which in the example above
leads to an infinite loop because that next tick is indefinitely
postponed.

This commit works around that at the cost of some added internal
complexity.

Fixes joyent/node#5516.
2013-05-22 17:00:17 +02:00
Ben Noordhuis
739a5b25b5 unix: add mapping for ENETDOWN 2013-05-20 20:05:33 +02:00
Ben Noordhuis
a1cb52a3eb darwin: task_info() cannot fail
And if it does: assert, don't return errno. It's a mach function, it
doesn't set errno.
2013-05-20 14:36:50 +02:00
Ben Noordhuis
e515d71592 darwin: make two uv__cf_*() functions static 2013-05-19 19:53:24 +02:00
Bert Belder
db7dc6899d win: fix UV_EALREADY incorrectly set
UV_EALREADY itself is already a libuv error, it should be set with
uv__set_artifical_error and not with uv__set_sys_error.

Closes #802
2013-05-18 20:45:36 +02:00
Fedor Indutny
d5fa633ef2 darwin: assume CFRunLoopStop() isn't thread-safe
Use signaling mechanism for loop termination, because CFRunLoopStop() is
most likely not a thread-safe function and invoking it from other thread
may sometimes result in a "dead-lock".

fix #799
2013-05-17 20:31:39 +04:00
Bert Belder
4f61ab2058 windows: make uv_spawn not fail under job control
* Fix a potential issue introduced with 415f4d3, namely that uv_spawn
  can fail when the current process is under job control. This would
  happen on Windows versions that don't support nested jobs (versions
  prior to Windows 8 / Server 2012).

* Change the `uv__init_global_job_handle` function signature to match
  what `uv_once` expects.

* Add a bunch of comments that clarify how we're using job control,
  and how we're dealing with job control that might be established by
  our parent process.
2013-05-16 21:29:40 +02:00
Bert Belder
13496e9c1a Now working on v0.10.8 2013-05-14 16:50:22 -07:00
Bert Belder
028baaf084 2013.05.15, Version 0.10.7 (Stable)
Changes since version 0.10.6:

* windows: kill child processes when the parent dies (Bert Belder)
2013-05-14 16:50:19 -07:00
Bert Belder
415f4d3e4c windows: kill child processes when the parent dies
This makes Windows behave just like Unix. This does not affect
processes that are spawned with the UV_PROCESS_DETACHED flag set.
2013-05-14 16:48:03 -07:00
isaacs
1fd10deec4 Now working on v0.10.7 2013-05-14 14:40:01 -07:00
isaacs
11e6613e62 2013.05.15, Version 0.10.6 (Stable)
Changes since version 0.10.5:

* stream: fix osx select hack (Fedor Indutny)

* stream: fix small nit in select hack, add test (Fedor Indutny)

* build: link with libkvm on openbsd (Ben Noordhuis)

* stream: use harder sync restrictions for osx-hack (Fedor Indutny)

* unix: fix EMFILE error handling (Ben Noordhuis)

* darwin: fix unnecessary include headers (Daisuke Murase)

* darwin: rename darwin-getproctitle.m (Ben Noordhuis)

* build: convert predefined $PLATFORM to lower case (Elliot Saba)

* build: set soname in shared library (Ben Noordhuis)

* build: make `make test` link against .a again (Ben Noordhuis)

* darwin: fix ios build, don't require ApplicationServices (Ben
  Noordhuis)

* build: only set soname on shared object builds (Timothy J. Fontaine)
2013-05-14 14:39:58 -07:00
Miroslav Bajtoš
0564ee4a66 test, sunos: disable process_title test
Disable unit test failing due to missing implementation
of uv_(set|get)_process_title for Sun OS (SmartOS).

Based on discussion with @tjfontaine, such implementation is difficult
if possible at all and it won't be done anytime soon. Thus there is
no point in keeping the failing test around.
2013-05-14 13:36:32 +02:00
Timothy J Fontaine
55c150abfc build: only set soname on shared object builds 2013-05-13 15:48:32 -07:00
Ben Noordhuis
f22163c233 darwin: fix ios build, don't require ApplicationServices 2013-05-13 20:16:20 +02:00
Ben Noordhuis
a11d16d8f5 build: make make test link against .a again
Commit 3eb6eb3 links the .so with -Wl,-soname which breaks the
`make test` target: run-tests is linked against (for example)
libuv.so.0.11 while the actual file name is libuv.so.

That's relatively easy to fix by getting creative with rpaths but it's
even easier to fix by simply linking statically.

It also means I no longer have to remember to set LD_BIND_NOW when
profiling the benchmarks.
2013-05-12 16:52:24 +02:00
Ben Noordhuis
3eb6eb35cc build: set soname in shared library 2013-05-12 14:50:58 +02:00
Elliot Saba
96a2df8084 build: convert predefined $PLATFORM to lower case 2013-05-12 02:40:12 +02:00
Miroslav Bajtoš
fe2a3150c0 test: add error logging to tty unit test 2013-05-08 17:20:20 -07:00
Miroslav Bajtoš
af6e865a07 test: fix process_title failing on linux
Shorten the test string from 40 to 38 characters because the title
length is limited to 39 characters.

Truncation of long titles was introduced intentionally by commit
a0c1d84 (see discussion in joyent/node#5006).
2013-05-08 17:20:20 -07:00
Miroslav Bajtoš
2c21050956 test: add RETURN_SKIP and RETURN_TODO macros
Added two new flags to identify tests that are intentionally ignored
(usually because we don't want to implement the tested functionality
on current platform) and test serving as TODO list (usually indicating
that the tested functionality should be implemented on current plaform
in the near future.)
2013-05-08 15:43:54 -07:00
Ben Noordhuis
9b801d551b darwin: rename darwin-getproctitle.m
Rename it to darwin-getproctitle.c, it doesn't need an Objective-C
compiler. Fix up -Wpedantic warnings about void to function pointer
casts and include <ApplicationServices/ApplicationServices.h> to get
the GetCurrentProcess() function prototype.
2013-05-02 14:10:12 +02:00
Daisuke Murase
4b0fac8990 darwin: fix unnecessary include headers
This file doesn't use any Cocoa functions, CoreFoundation.h is enough here.
This line causes compilation error on iOS environment.
2013-05-02 13:55:40 +02:00
Bert Belder
f6fb1dfef1 ChangeLog: fix incorrect release date 2013-04-22 17:37:22 -07:00
Ben Noordhuis
b3ab332b34 unix: fix EMFILE error handling
On Linux, the accept() and accept4() system calls checks for EMFILE
before checking for EAGAIN. Refine our EMFILE error handling tactic
to deal with that. Here is what used to happen:

 1. The event loop calls accept() and sees EMFILE.

 2. Libuv switches to EMFILE error handling mode. It closes a stashed
    file descriptor and calls accept() again.

 3. The accept() system call fails with EAGAIN.

 4. Libuv reopens the stashed file descriptor (reaching RLIMIT_NOFILE
    again) and returns control to the regular event loop.

 5. The regular event loop calls accept(), sees EMFILE and jumps to
    step 2 again. Effectively an infinite loop.

Avoid that by not calling accept() again when we've seen EAGAIN.

Fixes joyent/node#5389.
2013-05-01 19:37:45 +02:00
Fedor Indutny
67f9b91a8b stream: use harder sync restrictions for osx-hack
Synchronize harder to avoid excessive spins, invokations of async
callback and sporadic assertion failures on double-call of async
callback.
2013-04-30 14:07:30 +04:00
Ben Noordhuis
4e5b8dc2ef build: link with libkvm on openbsd
The Makefile already did and now the gyp build does too. Fixes the
OpenBSD build of node.js.

Fixes joyent/node#5363.
2013-04-29 13:40:12 +02:00
Fedor Indutny
ac4e7e7ff2 stream: fix small nit in select hack, add test 2013-04-27 18:50:55 +02:00
Fedor Indutny
2400716d87 stream: fix osx select hack
After latest twiddling, `stream->io_watcher.fd` doesn't contain a real
stream's file descriptior anymore. The one from `select_state` should be
used instead.

Zero-initialize `select_state->event` field.
2013-04-24 13:21:58 +02:00
isaacs
a0cb926e2e Now working on v0.10.6 2013-04-22 17:37:25 -07:00
isaacs
6595a7732c 2013.04.24, Version 0.10.5 (Stable)
Changes since version 0.10.4:

* unix: silence STATIC_ASSERT compiler warnings (Ben Noordhuis)

* windows: make timers handle large timeouts (Miroslav Bajtoš)

* windows: remove superfluous assert statement (Bert Belder)

* unix: silence STATIC_ASSERT compiler warnings (Ben Noordhuis)

* linux: don't use fopen() in uv_resident_set_memory() (Ben Noordhuis)
2013-04-22 17:37:22 -07:00
Ben Noordhuis
cd10637d0b linux: don't use fopen() in uv_resident_set_memory()
RSS is a reflection of the number of pages that a process has mapped.
glibc implements fopen() in terms of mmap() which means that trying
to read the number of mapped pages changes it. Switch to open().
2013-04-22 08:26:53 +02:00
Ben Noordhuis
105e4dcb23 unix: silence STATIC_ASSERT compiler warnings
Fix the following two warnings:

  src/unix/core.c:74:1: warning: ISO C90 forbids array
  'static_assert_failed' whose size can't be evaluated [-Wvla]
  src/unix/core.c:76:1: warning: ISO C90 forbids array
  'static_assert_failed' whose size can't be evaluated [-Wvla]
2013-04-22 07:48:09 +02:00
Bert Belder
a3963883b8 windows: remove superfluous assert statement 2013-04-18 02:56:07 +02:00
Miroslav Bajtoš
09ff5100e3 windows: make timers handle large timeouts
Fixes a bug where timers with very large timeouts run on the next tick.
Based on a similar bug fix for unix (9b61939).

Fixes joyent/node#5101.
2013-04-16 16:30:33 +02:00
Ben Noordhuis
ef85bdaffb unix: silence STATIC_ASSERT compiler warnings
Newer versions of gcc complain about the definition of the zero element
array. Squelch that warning by turning it into a one element array.
2013-04-12 19:40:57 +02:00
isaacs
5ed1d02cc0 Now working on v0.10.5 2013-04-11 09:00:10 -07:00
isaacs
85827e2640 2013.04.12, Version 0.10.4 (Stable)
Changes since version 0.10.3:

* include: update uv_backend_fd() documentation (Ben Noordhuis)

* unix: include uv.h in src/version.c (Ben Noordhuis)

* unix: don't write more than IOV_MAX iovecs (Fedor Indutny)

* mingw-w64: don't call _set_invalid_parameter_handler (Nils Maier)

* build: gyp disable thin archives (Timothy J. Fontaine)

* sunos: re-export entire library when static (Timothy J. Fontaine)

* unix: dtrace probes for tick-start and tick-stop (Timothy J. Fontaine)

* windows: fix memory leak in fs__sendfile (Shannen Saez)

* windows: remove double initialization in uv_tty_init (Shannen Saez)

* build: fix dtrace-enabled out of tree build (Ben Noordhuis)

* build: squelch -Wdollar-in-identifier-extension warnings (Ben
  Noordhuis)

* inet: snprintf returns int, not size_t (Brian White)

* win: refactor uv_cpu_info (Bert Belder)

* build: add support for Visual Studio 2012 (Nicholas Vavilov)

* build: -Wno-dollar-in-identifier-extension is clang only (Ben
  Noordhuis)
2013-04-11 09:00:06 -07:00
Ben Noordhuis
0ff06b4ac3 build: -Wno-dollar-in-identifier-extension is clang only
Add a compiler check because turning on the option unconditionally
breaks the build when CC=gcc.

This should also fix the build on versions of OS X that predate Apple's
switch to clang (10.6 and older.)
2013-04-10 23:46:24 +02:00
mscdex
633d33a92a cygwin: remove unused variable 2013-04-10 18:30:37 +02:00
Nicholas Vavilov
bc5fa794b9 build: add support for Visual Studio 2012
Closes #722
2013-04-10 16:13:32 +02:00
Bert Belder
a9bce29f0c win: refactor uv_cpu_info
Fixes a couple of error handling issues:

* Don't free an uninitialized pointer when allocating memory for
  `cpu_infos` fails.
* Don't return a bogus error value when NtQuerySystemInformation fails.
  That function returns an NTSTATUS code instead of setting the last
  error.
* Don't clobber out parameters when an error happens.
2013-04-10 16:04:15 +02:00
Brian White
9021dbcd8d inet: snprintf returns int, not size_t 2013-04-10 15:50:39 +02:00
Brian White
4d4f1496d9 windows, unix: remove dead code 2013-04-10 15:50:39 +02:00
Ben Noordhuis
8ea49c1223 build: squelch -Wdollar-in-identifier-extension warnings
The dtrace probes contain dollar signs. We know, llvm-gcc, and we don't
care. Suppress the warnings.
2013-04-10 14:31:39 +02:00
Ben Noordhuis
bad707db3f gitigore: ignore auto-generated uv-dtrace.h header 2013-04-10 14:23:55 +02:00
Ben Noordhuis
be5b16aabd build: fix dtrace-enabled out of tree build 2013-04-10 14:23:55 +02:00
Shannen Saez
603915dd00 windows: remove double initialization in uv_tty_init 2013-04-10 14:17:28 +02:00
Shannen Saez
7570a35b70 windows: fix memory leak in fs__sendfile 2013-04-10 14:17:28 +02:00