Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

node.http.Client doesn't seem to work on a Mac #3

Closed
n8agrin opened this issue Jun 3, 2009 · 12 comments
Closed

node.http.Client doesn't seem to work on a Mac #3

n8agrin opened this issue Jun 3, 2009 · 12 comments

Comments

@n8agrin
Copy link

n8agrin commented Jun 3, 2009

Env: Mac 10.5
Example code:

var google = new node.http.Client(80, "google.com");
var req = google.get("/");
req.flush();
req.finish(function (res) {
  puts("STATUS: " + res.statusCode);
  puts("HEADERS: " + JSON.stringify(res.headers));
  res.setBodyEncoding("utf8");
  res.onBody = function (chunk) {
    puts("BODY: " + chunk);
  };
});

Running the http.Client never returns any data, just hangs and a bump in cpu usage is noted.

@ry
Copy link

ry commented Jun 4, 2009

I've just fixed a rather large and gaping bug in http.Client that I think was causing this. Can you please try again with HEAD?

@sixtus
Copy link

sixtus commented Jun 4, 2009

Just signed up to github - so moving my mail reply to here. And the answer is, sorry, it didn't fix the issue.

@ujh
Copy link

ujh commented Jun 4, 2009

I can confirm that. Even at c226f81 it doesn't work on the Mac.

@ry
Copy link

ry commented Jun 4, 2009

okay - it's working on linux and freebsd. it will have to wait until i get mac access again.

@sixtus
Copy link

sixtus commented Jun 5, 2009

Do you have a schedule for that? I could work on a SSH account, if it'll take too long.

@ujh
Copy link

ujh commented Jun 5, 2009

I'll setup and account for Ryan on Sunday or Monday. You're welcome to do that before that of course :)

@sixtus
Copy link

sixtus commented Jun 5, 2009

I don't think I will get our Admins to open a port before Monday. But "this weekend" is very well within my time restrictions of waiting for a working node to migrate to it.

@ry
Copy link

ry commented Jun 10, 2009

So - there seems to be a problem during getaddrinfo() which I can't figure out.
As a temporary solution I've made a change on macintosh which synchronously does DNS resolution for tcp clients. This is in 080fa54

Experiencing some other problems with this change on linux, so I will leave the issue open for the moment. It might be that I'm corrupting the heap at some point (but valgrind isn't telling me?).

@ry
Copy link

ry commented Jun 11, 2009

I'm satisfied with the hacked solution for now. Going to switch to udns at soon, so perhaps it's not even worth investigating

@ThisIsMissEm
Copy link

hmm.. using HEAD and the example code provided, I'm getting:

native runtime.js:404
throw %MakeTypeError('called_non_callable',[typeof a]);
^
TypeError: undefined is not a function
at Object.CALL_NON_FUNCTION_AS_CONSTRUCTOR (native)
at Object. (/Users/micheil/var/tmp/node-issue3.js:1:79)
at [object Object]. (node.js:897:21)
at [object Object].emitSuccess (node.js:260:13)
at [object Object]. (node.js:652:21)
at [object Object].emitSuccess (node.js:260:13)
at node.js:509:29
at node.js:950:1
at node.js:954:1


System Version: Mac OS X 10.6.2 (10C540)

@ry
Copy link

ry commented Dec 18, 2009

Miksago, the API has changed dramatically since then. Here is the example updated for v0.1.21-31-g2507b87

http = require("http");
sys = require("sys");
var google = http.createClient(80, "google.com");
var req = google.request("GET", "/");
req.flush();
req.finish(function (res) {
  sys.puts("STATUS: " + res.statusCode);
  sys.puts("HEADERS: " + JSON.stringify(res.headers));
  res.setBodyEncoding("utf8");
  res.onBody = function (chunk) {
    sys.puts("BODY: " + chunk);
  };
});

@ThisIsMissEm
Copy link

My bad for reply on a closed issue.

pismute pushed a commit to pismute/node that referenced this issue Jul 13, 2012
bnoordhuis added a commit that referenced this issue Apr 10, 2013
Call SetPointerInInternalField(0, NULL) rather than
SetInternalField(0, Undefined()).

Fixes the following spurious NULL pointer dereference in debug builds:

  #0  0x03ad2821 in v8::internal::FixedArrayBase::length ()
  #1  0x03ad1dfc in v8::internal::FixedArray::get ()
  #2  0x03ae05dd in v8::internal::Context::global_object ()
  #3  0x03b6b87d in v8::internal::Context::builtins ()
  #4  0x03ae1871 in v8::internal::Isolate::js_builtins_object ()
  #5  0x03ab4fab in v8::CallV8HeapFunction ()
  #6  0x03ab4d4a in v8::Value::Equals ()
  #7  0x03b4f38b in CheckEqualsHelper ()
  #8  0x03ac0f4b in v8::Object::SetInternalField ()
  #9  0x06a99ddd in node::ObjectWrap::~ObjectWrap ()
  #10 0x06a8b051 in node::Buffer::~Buffer ()
  #11 0x06a8afbb in node::Buffer::~Buffer ()
  #12 0x06a8af5e in node::Buffer::~Buffer ()
  #13 0x06a9e569 in node::ObjectWrap::WeakCallback ()
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants