Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node/npm needs SSE #90

Closed
philipamour opened this issue Nov 14, 2018 · 57 comments
Closed

node/npm needs SSE #90

philipamour opened this issue Nov 14, 2018 · 57 comments

Comments

@philipamour
Copy link

Running npm or node returns 'Bad system call'

@Mnpn
Copy link
Member

Mnpn commented Nov 14, 2018

Node is on the list. https://github.com/tbodt/ish/projects/7

@mattapperson
Copy link

If someone (me) wanted to push this forward. Is there a recommended place to start debugging what’s needed here?

@tbodt
Copy link
Member

tbodt commented Nov 19, 2018

You can try to run the program with strace logging enabled (on by default in Xcode, meson configure -Dlog=strace if you're running ish standalone), and find out what system call it's attempting to use. My hunch is that you'll find it's trying to call epoll_create, which is the entry point to an entire unimplemented subsystem that will have to be implemented before node can get anywhere at all. If you're feeling up to the task, a decent starting point would be the implementations of select and poll.

@mattapperson
Copy link

Spent some time looking into this... it’s just a little too much outside my current ability I’m sad to say 😞

@philipamour
Copy link
Author

Wish I could help anyhow; however, my expertise is limited to software design (iXD, UI, UX, PM, ...)

Sent with GitHawk

This was referenced Dec 1, 2018
@Mnpn
Copy link
Member

Mnpn commented Jan 2, 2019

No longer a bad system call:

Device:~# node
Illegal instruction
Device:~# dmesg
FIXME socketcall 16
13 page fault on 0x50 at 0x567336fd
unknown ioctl 5451
unknown ioctl 5451
unknown ioctl 5451
19 illegal instruction at 0x56cc250f: f2 0f 10 02 b2 00 66 0f

@kaleocheng
Copy link

what's the next for this?

@tbodt
Copy link
Member

tbodt commented Jan 30, 2019

SSE2 instructions. If you want to work on it, feel free.

@zerkotin
Copy link

is it a priority? it would be amazing to be able to run node so I can build my project and run it

@Envo
Copy link

Envo commented Mar 18, 2019

Any update on this?

@tbodt
Copy link
Member

tbodt commented Mar 18, 2019

no

@pburtchaell
Copy link

pburtchaell commented Mar 18, 2019

Lurker here. To all of the folks replying with "Any update? What's next? What's the priority?", please don't. It's disrespectful to the community and the owner of this project to hammer issues with rhetorical questions.

This is an open source project and the issue is clearly up for grabs (see "No one assigned" on the assignees space). If you're interested in seeing node support added, subscribe to the issue and either (a) do it yourself or (b) wait for someone else to do it.

@zerkotin
Copy link

A. No one means any disrespect, if anything we cared enough to search for the repo and look for bugs...
B. If I or anyone had a clue how to do that we probably would, but we don’t,
C. It’s important to be able to run JavaScript on iPad because it will open a whole ne world, and as you can see from the poll you made on the main page, most people use JavaScript html and so on

Please see it as a plea to push it up the priority ladder instead of a disrespectful comment.

@tbodt
Copy link
Member

tbodt commented Mar 19, 2019

What's the poll I made on the main page?

@zerkotin
Copy link

zerkotin commented Mar 19, 2019

@Envo
Copy link

Envo commented Mar 20, 2019

I'm sorry if i was disrespectful, it wasn't my intention.

@Macmee
Copy link

Macmee commented Mar 28, 2019

to get node to work, don't we need to implement SSE2 which is pretty big?

@tbodt
Copy link
Member

tbodt commented Mar 28, 2019

Yeah

@InukVT
Copy link
Contributor

InukVT commented Apr 19, 2019

Would it make sense to abuse JavaScriptCore somehow (not that I know how) to add node support for those who wants it?

I see how this can be problematic for those who doesn't care about nodes at all in iOS (such as myself)

@tbodt
Copy link
Member

tbodt commented Apr 19, 2019

No, JavaScriptCore isn't a good substitute for Node. They're completely different programs, with different supported features.

@bc1bb
Copy link

bc1bb commented Apr 19, 2019

is it a priority? it would be amazing to be able to run node so I can build my project and run it

btw Rescript (free on Apple's App Store) has a full and working environment in NodeJS

@tbodt
Copy link
Member

tbodt commented Apr 19, 2019

That's pretty cool, I haven't seen it before. I bet it's really slow though.

@bc1bb
Copy link

bc1bb commented Apr 19, 2019

i tried it one time on my iPad (6th) it was pretty good, don't know if it's what he wants

@InukVT
Copy link
Contributor

InukVT commented Apr 19, 2019

Their sample project is super fast!

@tbodt

This comment has been minimized.

@tbodt
Copy link
Member

tbodt commented Apr 27, 2020

Sorry didn't see you were a sponsor. But not in this case, my sponsor page is just a way for you to express your appreciation.

@marfier
Copy link

marfier commented Jun 5, 2020

Could SpiderNode be a workaround to this issue? SpiderNode is basically Node.js decoupled from V8 to SpiderMonkey.

Edit: Just realized that SpiderNode is dead, and also compiling from source is not easy on iSH.

tbodt added a commit that referenced this issue Jun 9, 2020
mfence, ucomisd, comisd, movmskpd, andpd, punpckldq, psubq, comiss,
andps, andnps, maxsd, cmpsd. Enough for a node repl.

#90
@itsmepetrov
Copy link

itsmepetrov commented Jun 22, 2020

@tbodt I've tried to run nodejs using 55816c8 changes.

Now it's able to run nodejs but it can't close the process.

How to reproduce:

apk add nodejs
echo "console.log(123);" > index.js
node index.js

It prints 123 and gets stuck after that.

@tbodt
Copy link
Member

tbodt commented Jun 22, 2020

That's for the same reason as #472 AFAICT

tbodt added a commit that referenced this issue Jun 25, 2020
Fixes #472 and node hanging on exit (#90)
tbodt added a commit that referenced this issue Jun 25, 2020
Fixes ctrl-c sometimes sending Node's signal handler into an infinite
loop. #90
tbodt added a commit that referenced this issue Jun 25, 2020
Node seems to use these archaic phrasings of CLOEXEC. This fixes the
Node inspector immediately closing any connections it gets. #90
tbodt added a commit that referenced this issue Jun 26, 2020
Fixes 3 / 2 returning 0 in node #90
tbodt added a commit that referenced this issue Jul 3, 2020
This was causing the random node segfaults. Node does manual ASLR, so it
would randomly pick an address for a memory mapping near the brk region,
then later something would raise the brk and clobber that mapping,
replacing it with zeroes. Shortly afterward something would crash on a
null pointer.

Took a lot of digging around in rr to find this. The crash is never
directly connected to the brk call, of course. I set a watchpoint on the
pointer that got clobbered and saw it had been zero since the page was
mapped, but it took setting a watchpoint on the pointer to that pointer
to find that when it was mapped before that and was valid at that point.

At this point I'm ready to say node is fixed! #90
@tbodt
Copy link
Member

tbodt commented Jul 6, 2020

I think this is pretty much done now.

@tbodt tbodt closed this as completed Jul 6, 2020
@Rexogamer
Copy link
Contributor

Do you get the bounty?

@tbodt
Copy link
Member

tbodt commented Jul 6, 2020

I think so

@saagarjha
Copy link
Member

what are you going to do with your newfound wealth

@mattapperson
Copy link

@tbodt if so, I missed there was a bounty. Happy to contribute to the windfall from this

@tbodt
Copy link
Member

tbodt commented Jul 7, 2020

@mattapperson You may do so at https://www.bountysource.com/issues/66159647-node-npm-needs-sse (except maybe not now since the issue is closed, I have no idea how bountysource works)

@mattapperson
Copy link

Yea it's closed now, won't let me add to the bounty. Before you claim the next one let me know? ill just back that one

Mnpn pushed a commit to Mnpn/ish that referenced this issue Oct 22, 2020
mfence, ucomisd, comisd, movmskpd, andpd, punpckldq, psubq, comiss,
andps, andnps, maxsd, cmpsd. Enough for a node repl.

ish-app#90
Mnpn pushed a commit to Mnpn/ish that referenced this issue Oct 22, 2020
Fixes ish-app#472 and node hanging on exit (ish-app#90)
Mnpn pushed a commit to Mnpn/ish that referenced this issue Oct 22, 2020
Fixes ctrl-c sometimes sending Node's signal handler into an infinite
loop. ish-app#90
Mnpn pushed a commit to Mnpn/ish that referenced this issue Oct 22, 2020
Node seems to use these archaic phrasings of CLOEXEC. This fixes the
Node inspector immediately closing any connections it gets. ish-app#90
Mnpn pushed a commit to Mnpn/ish that referenced this issue Oct 22, 2020
Fixes 3 / 2 returning 0 in node ish-app#90
Mnpn pushed a commit to Mnpn/ish that referenced this issue Oct 22, 2020
This was causing the random node segfaults. Node does manual ASLR, so it
would randomly pick an address for a memory mapping near the brk region,
then later something would raise the brk and clobber that mapping,
replacing it with zeroes. Shortly afterward something would crash on a
null pointer.

Took a lot of digging around in rr to find this. The crash is never
directly connected to the brk call, of course. I set a watchpoint on the
pointer that got clobbered and saw it had been zero since the page was
mapped, but it took setting a watchpoint on the pointer to that pointer
to find that when it was mapped before that and was valid at that point.

At this point I'm ready to say node is fixed! ish-app#90
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests