Skip to content
This repository has been archived by the owner on Aug 31, 2018. It is now read-only.

Let's have a real conversation #6

Closed
ChrisCates opened this issue Aug 23, 2017 · 10 comments
Closed

Let's have a real conversation #6

ChrisCates opened this issue Aug 23, 2017 · 10 comments

Comments

@ChrisCates
Copy link

ChrisCates commented Aug 23, 2017

Just a note: I've been banned from Ayo.js for no reason specified other than my comments (but this was not even directly said to me) and find this entire situation extremely ironic considering the entire purpose of this Ayo.js fork to begin with was from bureaucracy in the Node.js community. The point of my proposal was because you intended on doing a fork and seemed like a good opportunity to ask for some MUCH needed design changes at the compiler level. Instead you ask me to "pick another language" when Javascript is literally embedded in our browsers... That kind of thinking is absurd. I wish I could boycott this especially given how community members act... But look at me now I'm on a browser...

I'm sure many of us use Node.js day to day due to obligations work related.

But let's actually solve problems with the core language design itself and not build off of the mediocre at best cost abstractions Javascript originated from.

  1. Dynamic Type Inference
    It's no surprise that types are god awful in Node.js. Whether you are casting from String to Integer and so forth. We don't even have the option between integers or unsigned integers. I think a simple pragmatic solution is to adopt a model similar to Golang where the compiler computes the type intelligently and we can also verbosely define types. Typescript kind of amplifies the problem with types by explicitly defining things as number or string as opposed to more granular types that are given in other languages.

  2. Threading... beyond barely usable mutex like functionality.
    I don't even think it's possible to utilize semaphore like primitives in Node.js. I believe there are some GYP implementations in the NPM ecosystem... However, proper threading management is pretty damn important. Especially if we want to build robust frameworks. Perhaps we can even adopt compiler logic like Erlang's or Rust's where we automatically utilize all threads for any computation.

  3. Atomic Operations
    Another huge problem with Node.js is the inability to utilize Atomic Operations. These are pretty important for critical computations. And Node.js kind of throws the entire idea of atomic computations out the window. This is a big reason why a viable database can't be built in Node.js due to lack of atomicity and inability to adhere to ACID compliance.

  4. Improving bad cost abstractions
    This goes beyond the async model in general... But rather... A lot of the core design of Javascript itself. For example we can't even utilize stacks or heaps in the native standard library. I could go on. But this can be improved by orders of magnitude to where it is now. Would be interesting to adopt data structures like Ring Buffers, Linked Lists and Double Ended Queues in the native library. Especially if we optimized abstractions in the assembly logic. I would be especially happy if we can utilize a lot of different graph techniques in the standard library... But that may be veering off more into a MATLAB approach to language design, but worth discussing anyway.

@hashseed
Copy link
Contributor

Chances are pretty slim for these proposal to make into V8 if they are not made part of ECMA262 standard through TC39. I'm pretty sure this applies to ChakraCore too.

It sounds like you want a different language with other design goals. How about Java, Go, or Dart?

@ChrisCates
Copy link
Author

ChrisCates commented Aug 23, 2017

@hashseed "I'm sure many of us use Node.js day to day due to obligations work related."
Go and Java are pretty solid. Dart is awesome too, but kind of defeats the purpose of my statement.

Seems like more bureaucratic bullshit is required in order to get any shit done in the Open Source world. Good thing I don't really participate in any of it, thought this would be an opportunity to write something meaningful for the community. Thanks for informing me though.

@hashseed
Copy link
Contributor

V8 is open source, so you can definitely fork it too. I'm just saying that you won't be able to get these changes into upstream V8.

@ChrisCates
Copy link
Author

ChrisCates commented Aug 23, 2017

@hashseed then what is the point of even forking it if no one else is going to use it. I'd rather just use Elixir and C/++ at that point. I don't even have 100 followers on Github and not even 1k followers on Facebook. Not sure how anything I produce would gain any traction whatsoever. Just kind of reality you know?

I've spent enough time doing similar things living in my own bubble. No need to spend time engineering things that don't really benefit me (but could benefit a lot of other people... technically the entire internet... but hey... Politics is politics).

@hashseed
Copy link
Contributor

Remember the days when every browser had its own flavor of JavaScript? That's what you are proposing, essentially.

@ChrisCates
Copy link
Author

ChrisCates commented Aug 23, 2017

@hashseed I proposed it to be the new standard. That's a little different. However, no one wants it to be a standard. Therefore, I have no interest in pursuing it, because I would literally be living in my own bubble. You're part of the core Chromium and V8 team so you know how the political system works there. Pretty sure I won't be able to get anything meaningful done for the project if this is the kind of response I get.

@ansuz
Copy link

ansuz commented Aug 23, 2017

🤣

@addaleax
Copy link
Contributor

Fwiw, threading in the form of standard (Web)Workers is something I’ve been wanting to approach anyway in Node.js.

Also, while I agree with what @hashseed is saying here, I think it’s also worth mentioning that the amount of technical work required to affect language features is huge compared to the work just going on working on Node; so: If you want to change the language via forking, it’s likely better to start with a fork of a JS engine, not a fork of Node.

@Fishrock123
Copy link
Contributor

I've been banned from Ayo.js for no reason specified other than my comments

@ChrisCates The repo was locked down for 24h due to spam in some other threads, as far as I can tell what you are saying in this edit is not the case.

@Qard
Copy link
Member

Qard commented Aug 25, 2017

Adding dynamic type inference to the language would be an enormous amount of work. Like tens of thousands of human hours. It's not really reasonable to expect a small team of people just using a JS virtual machine to have the capacity to make this change on their own. You could take it to TC39 or try to build it yourself.

Threading is reasonably possible, though still quite a bit of work. There was prior effort to get web workers into Node.js, so we could probably take that and finish it.

I get what you're saying about atomic operations and low-level data structures, but those are systems-y things, and JS is just not meant for that. JS and ayo are intended more for app development purposes than systems development.

addaleax pushed a commit that referenced this issue Oct 26, 2017
Currently when running the test without an internet connection there are
two JavaScript test failures and one cctest. The cctest only fails on
Mac as far as I know. (I've only tested using Mac and Linux thus far).

This commit moves the two JavaScript tests to test/internet.

The details for test_inspector_socket_server.cc:

[ RUN      ] InspectorSocketServerTest.FailsToBindToNodejsHost
make[1]: *** [cctest] Segmentation fault: 11
make: *** [test] Error 2

lldb output:

[ RUN      ] InspectorSocketServerTest.FailsToBindToNodejsHost
Process 63058 stopped
* thread #1: tid = 0x7b175, 0x00007fff96d04384
* libsystem_info.dylib`_gai_simple + 87, queue =
* 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1,
* address=0x0)
    frame #0: 0x00007fff96d04384 libsystem_info.dylib`_gai_simple + 87
libsystem_info.dylib`_gai_simple:
->  0x7fff96d04384 <+87>: movw   (%rdx), %ax
    0x7fff96d04387 <+90>: movw   %ax, -0x2a(%rbp)
    0x7fff96d0438b <+94>: movq   %r13, -0x38(%rbp)
    0x7fff96d0438f <+98>: movq   0x18(%rbp), %rcx

(lldb) bt
* thread #1: tid = 0x7b175, 0x00007fff96d04384
* libsystem_info.dylib`_gai_simple + 87, queue =
* 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1,
* address=0x0)
  * frame #0: 0x00007fff96d04384 libsystem_info.dylib`_gai_simple + 87
    frame #1: 0x00007fff96cfe98b libsystem_info.dylib`search_addrinfo +
179
    frame #2: 0x00007fff96cfafef libsystem_info.dylib`si_addrinfo + 2255
    frame #3: 0x00007fff96cfa67b libsystem_info.dylib`getaddrinfo + 179
    frame #4: 0x00000001017d8888
cctest`uv__getaddrinfo_work(w=0x00007fff5fbfe210) + 72 at
getaddrinfo.c:102
    frame #5: 0x00000001017d880e
cctest`uv_getaddrinfo(loop=0x000000010287cb80, req=0x00007fff5fbfe1c8,
cb=0x0000000000000000, hostname="nodejs.org", service="0",
hints=0x00007fff5fbfe268) + 734 at getaddrinfo.c:192
    frame #6: 0x000000010171f781
cctest`node::inspector::InspectorSocketServer::Start(this=0x00007fff5fbfe658)
+ 801 at inspector_socket_server.cc:398
    frame #7: 0x00000001016ed590
cctest`InspectorSocketServerTest_FailsToBindToNodejsHost_Test::TestBody(this=0x0000000105001fd0)
+ 288 at test_inspector_socket_server.cc:593

I'm not sure about the exact cause for this but when using a standalone
c program to simulate this it seems like when the ai_flags
`AI_NUMERICSERV` is set, which is done in inspector_socket_server.cc
line 394, the servname (the port in the FailsToBindToNodejsHost test) is
expected to be a numeric port string to avoid looking it up in
/etc/services. When the port is 0 as is it was before this commit the
segment fault occurs but not if it is non-zero.

PR-URL: nodejs/node#16255
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
addaleax pushed a commit that referenced this issue Dec 7, 2017
Currently when running the test without an internet connection there are
two JavaScript test failures and one cctest. The cctest only fails on
Mac as far as I know. (I've only tested using Mac and Linux thus far).

This commit moves the two JavaScript tests to test/internet.

The details for test_inspector_socket_server.cc:

[ RUN      ] InspectorSocketServerTest.FailsToBindToNodejsHost
make[1]: *** [cctest] Segmentation fault: 11
make: *** [test] Error 2

lldb output:

[ RUN      ] InspectorSocketServerTest.FailsToBindToNodejsHost
Process 63058 stopped
* thread #1: tid = 0x7b175, 0x00007fff96d04384
* libsystem_info.dylib`_gai_simple + 87, queue =
* 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1,
* address=0x0)
    frame #0: 0x00007fff96d04384 libsystem_info.dylib`_gai_simple + 87
libsystem_info.dylib`_gai_simple:
->  0x7fff96d04384 <+87>: movw   (%rdx), %ax
    0x7fff96d04387 <+90>: movw   %ax, -0x2a(%rbp)
    0x7fff96d0438b <+94>: movq   %r13, -0x38(%rbp)
    0x7fff96d0438f <+98>: movq   0x18(%rbp), %rcx

(lldb) bt
* thread #1: tid = 0x7b175, 0x00007fff96d04384
* libsystem_info.dylib`_gai_simple + 87, queue =
* 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1,
* address=0x0)
  * frame #0: 0x00007fff96d04384 libsystem_info.dylib`_gai_simple + 87
    frame #1: 0x00007fff96cfe98b libsystem_info.dylib`search_addrinfo +
179
    frame #2: 0x00007fff96cfafef libsystem_info.dylib`si_addrinfo + 2255
    frame #3: 0x00007fff96cfa67b libsystem_info.dylib`getaddrinfo + 179
    frame #4: 0x00000001017d8888
cctest`uv__getaddrinfo_work(w=0x00007fff5fbfe210) + 72 at
getaddrinfo.c:102
    frame #5: 0x00000001017d880e
cctest`uv_getaddrinfo(loop=0x000000010287cb80, req=0x00007fff5fbfe1c8,
cb=0x0000000000000000, hostname="nodejs.org", service="0",
hints=0x00007fff5fbfe268) + 734 at getaddrinfo.c:192
    frame #6: 0x000000010171f781
cctest`node::inspector::InspectorSocketServer::Start(this=0x00007fff5fbfe658)
+ 801 at inspector_socket_server.cc:398
    frame #7: 0x00000001016ed590
cctest`InspectorSocketServerTest_FailsToBindToNodejsHost_Test::TestBody(this=0x0000000105001fd0)
+ 288 at test_inspector_socket_server.cc:593

I'm not sure about the exact cause for this but when using a standalone
c program to simulate this it seems like when the ai_flags
`AI_NUMERICSERV` is set, which is done in inspector_socket_server.cc
line 394, the servname (the port in the FailsToBindToNodejsHost test) is
expected to be a numeric port string to avoid looking it up in
/etc/services. When the port is 0 as is it was before this commit the
segment fault occurs but not if it is non-zero.

PR-URL: nodejs/node#16255
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
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

6 participants