Commit Graph
2214 Commits
Author SHA1 Message Date
Ryan Dahl 44fa89cda8 Add ref to buffer during fs.write and fs.read
There was the possibility the buffer could be GCed while the eio_req was
pending.  Still needs test coverage for the fs.read() problem.

See:
http://groups.google.com/group/nodejs/browse_thread/thread/c11f8b683f37cef
2010-11-16 16:45:26 -08:00
Ryan Dahl ba5ac87b12 Fix OS::GetExecutablePath for platform_none 2010-11-16 10:56:12 -08:00
isaacs c73041b3d5 writeFile fixes
writeFileSync could exhibit pathological behavior when a buffer could
not be written to the file in a single write() call.

Also, writeFile was not quite as optimized as it could be.
2010-11-16 10:55:30 -08:00
Ben Noordhuis 8d578df4b6 Add --profile flag to configure script, enables gprof profiling. 2010-11-16 10:55:04 -08:00
Ryan Dahl e006edab57 Fix segfault on test-crypto
Plus random cleanups. This code needs help.

Conflicts:

	src/node_crypto.cc
2010-11-16 10:53:06 -08:00
Ryan Dahl 9a066c99e4 Simplify REPL displayPrompt
Now that we insert \r into the stream and aren't switching back and forth
between termios modes, not need to worry about when to display the prompt.
2010-11-16 10:50:00 -08:00
Ryan Dahl 44db37859d Add writeFilter when in the readline
Switch \n with \r\n for all strings printed out.
Necessary for writev patch.
2010-11-16 10:49:26 -08:00
Ryan Dahl 7590075ea7 Remove -e from echo in test. Non-portable 2010-11-16 10:48:38 -08:00
Ryan Dahl 299eda8a6c Upgrade http-parser 2010-11-16 10:47:39 -08:00
Guillaume Tuton ebbaa86e7a Set FD_CLOEXEC flag on stdio FDs before spawning.
With regression test.
2010-11-16 10:41:41 -08:00
Ryan Dahl c6d214739a Remove unnecessary ref/unref in iowatcher cb 2010-11-16 10:41:25 -08:00
Ben Noordhuis 96e0615369 Make writes to process.env update the real environment. Tests included. 2010-11-16 10:41:15 -08:00
Chandra Sekar S 4e0c7dd3be Removed range read optimization as it doesn't work with libeio. 2010-11-16 10:39:02 -08:00
Ryan Dahl 67cc6d70a5 Make sure watcher.set() isn't being called when active
Conflicts:

	lib/dns.js
2010-11-16 10:38:23 -08:00
Ryan Dahl 825308a45c Fix argv[6] comment in node_file 2010-11-16 10:36:57 -08:00
Ryan Dahl b6eeddeb17 Rewrite libeio After callback to use req->result instead of req->errorno for error checking
Conflicts:

	src/node_file.cc
2010-11-16 10:36:46 -08:00
Ryan Dahl ae2087460b Abstract out a Server.prototype.pause method 2010-11-16 10:25:58 -08:00
Ryan Dahl d2828ea2a5 Abstract out net.Server.prototype._rejectPending
Does the same timeout action for maxConnections as it does for EMFILE.

Conflicts:

	lib/net.js
2010-11-16 10:25:53 -08:00
Ryan Dahl 26b3f228ad Module-level EMFILE handling
All net servers now share the same dummy socket. The ulimit warning is
throttled for all servers.

Conflicts:

	lib/net.js
2010-11-16 10:24:48 -08:00
isaacs 3c9746de24 Handle cyclic links smarter in fs.realpath
Rather than aborting in the face of *any* repeated link in a given path,
instead only abort if such a cycle actually makes a given path unresolvable.

Test for this by doing a normal stat.  Still use the seenLinks object to
cache link contents so as to cut own a little bit on readlink calls.

Also add a pathological test that fails without the change to fs.js.
2010-11-16 10:22:46 -08:00
Jorge Chamorro Bieling f76b65755f make "node --eval" eval in the global scope. 2010-11-16 10:22:30 -08:00
Ryan Dahl b70149856d Add extra anti-DoS tech to net.Server
Conflicts:

	lib/net.js
2010-11-16 10:20:39 -08:00
Ryan Dahl 9634669cc7 Improve idle benchmarks 2010-11-16 10:14:19 -08:00
Ryan Dahl ab86f597bc Gracefully handle EMFILE
Implementing a tip from Marc Lehmann:
http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#The_special_problem_of_accept_ing_wh

Keep an extra FD around for every server. When you hit EMFILE, destroy that
FD, accept a connection, close it; in this way you can clear the connection
queue and let people know that you're overload.

No more timeout needed.

Conflicts:

	lib/net.js
2010-11-16 10:12:53 -08:00
Ryan Dahl c42a5cc8eb Fix test-http-buffer-sanity
Backported from 7e24a05cba
Add test/simple/test-http-curl-chunk-problem.js
2010-11-01 18:19:54 -07:00
Ryan Dahl f8f675ba41 Add broken test passing a buffer through http 2010-11-01 18:19:53 -07:00
Ryan Dahl 428a670121 bump version to 0.2.4 v0.2.4 2010-10-24 14:45:39 -07:00
Ryan Dahl f7bc7fb031 Make sure Error object on exec() gets killed member
Also default to SIGTERM for destruction when exceeding timeout or buffer on
exec()

Back ported from v0.3; original commits:
bd8e4f656e
5a98fa4809
6570cd99e5
9bf2975f78
2010-10-24 12:57:57 -07:00
Ryan Dahl d3e6834297 Add isatty for isaacs 2010-10-24 12:27:28 -07:00
Ryan Dahl a958ebfca0 one more 'listening' race condition 2010-10-24 12:26:47 -07:00
Ryan Dahl 78afb12663 Fix a few 'listening' race conditions
in test-http-client-parse-error
2010-10-24 12:26:32 -07:00
Ryan Dahl ad4fb5319b Do not spin on aceept() with EMFILE
When a server hit EMFILE it would continue to try to accept new connections
from the queue. This patch introduces a timeout of one second where it will
stop trying to accept new files. After the second is over it tries again.

This is a rather serious bug that has been effecting many highly concurrent
programs. It was introduced in 4593c0, version v0.2.0.

TODO: A test for this situation. Currently I test it like this

  termA% cd projects/node
  termA% ulimit -n 256
  termA% ./node benchmark/idle_server.js

  termB% cd projects/node
  termB% ./node benchmark/idle_clients.js

And watch how the server process behaves.
2010-10-24 12:25:04 -07:00
Tom Hughes 1e932ea930 Add signal handlers so we clean up before exiting.
Add SIGTERM and SIGINT signal handlers so that we run the exit handlers
before exiting when getting these signals. Fixes an issue where we
couldn't run vi after CTRL+C'ing node because the stdin fd was left
non-blocking.

Also the test from ceb5331a64
2010-10-23 19:14:08 -07:00
Vitali Lovich ddb06cb552 Fix parsing of linux memory
If process name contains a space, this parsing fails for no good reason.
2010-10-23 19:08:22 -07:00
Ryan Dahl 60b5bcac0c Write write.txt into the tmpdir 2010-10-23 19:08:15 -07:00
Ryan Dahl 46eda290be Remove a confusing sentence in the docs 2010-10-23 19:08:05 -07:00
Tom Hughes c19897b76a Add --max-stack-size flag.
v8 doesn't expose a command-line flag to set the stack size, so this
adds a new flag that node understands how to handle and uses v8's
ResourceConstraints API.
2010-10-23 18:32:20 -07:00
Ryan Dahl 8ec4870611 Fix race conditions in test-http-upgrade-client2 2010-10-23 18:30:17 -07:00
Ryan Dahl 8fb9cd2575 Fix test harness for Linux
Mostly just upgraded tools/test.py to the latest one that's in V8.  But also
fixing the before and after hooks to preserve the test/tmp directory so that
running tests manually usually works.
2010-10-23 18:30:04 -07:00
Ryan Dahl 006e283b78 Add idle connection test 2010-10-23 18:27:59 -07:00
Ryan Dahl bdd82b7c5f Add 'make bench' script 2010-10-23 18:27:52 -07:00
Ryan Dahl 9f25dc1625 Improve benchmark/http_simple.js 2010-10-23 18:27:42 -07:00
Nathan Rajlich 511f80b3c8 http-parser: Allow whitespace in the 'Content-Length' header. 2010-10-23 18:26:46 -07:00
Joshua Peek 13dba0d1c1 Don't flush net writeQueue on end() if its still connecting 2010-10-23 18:26:07 -07:00
Ryan Dahl 97e3040202 Add future API for 'util' module 2010-10-23 18:18:24 -07:00
Rasmus Andersson 78fac9b863 environ symbol fix for Mac OS X 2010-10-23 18:16:40 -07:00
Ryan Dahl 969ee3dd83 Add flag to disable colors in REPL 2010-10-23 18:16:10 -07:00
Ryan Dahl 39a2a9d1b6 TCP clients should buffer writes before connection 2010-10-23 18:15:01 -07:00
TJ Holowaychuk 08f1bf42bb Added -e, --eval 2010-10-23 16:07:02 -07:00
Ryan Dahl 18ff6db648 ClearWeak on ObjectWraps. I /think/ this is the correct semantics 2010-10-23 16:06:51 -07:00