Fwd: libuv inside proot ?

51 views
Skip to first unread message

Maxence Dalmais

unread,
Oct 11, 2013, 4:55:30 AM10/11/13
to proo...@googlegroups.com
Hi,

I currently face an issue running NodeJS server inside proot.
The TCP connection failed when a client try a connection.

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: accept EIO
    at errnoException (net.js:901:11)
    at TCP.onconnection (net.js:1160:24)


NodeJS doesn't use classical socket call, but use the libuv, which is more asynchronous.
You can find below the message I post the the libuv google groups.

Does anybody succesffuly run a nodeJS (>0.6) server inside a proot ?
Do you have any idea which such a thing would failed ?

Bests regards,

Max

On Friday, October 11, 2013 10:32:13 AM UTC+2, Maxence Dalmais wrote:
Hi,

I am currently playing with Proot, a user-space implementation of chrootmount --bind, and binfmt_misc.
Unfortunate, I am not able to run for example a NodeJS server inside.
I got successful results with TCP server not using libuv.

I am not sure whether the problem come from proot, libuv, or if it is a total incompatibility that can't be solved.

I tried this with at least 3 kernels and differents proot roots.

You can find below some logs.

Do you guy's have any idea of what could be possibly wrong ?

Cheers, 

Max

_________________________________________

Outside the proot (everything works fine)
$ make check
[% 100|+ 195|-   0|T   0|S   0]: Done.
PASS: test/run-tests
=============
1 test passed
=============

Inside the proot
proot -R /
$ make check
=============================================================
[%  10|+  20|-   0|T   0|S   0]: ipc_listen_before_write
`ipc_listen_before_write` failed: exit code 6
Output from process `ipc_listen_before_write`:
got 6 bytes
error recving on channel: connection reset by peer
=============================================================
[%  10|+  20|-   1|T   0|S   0]: ipc_listen_after_write
`ipc_listen_after_write` failed: exit code 6
Output from process `ipc_listen_after_write`:
got 6 bytes
error recving on channel: connection reset by peer
=============================================================
[%  12|+  22|-   2|T   0|S   0]: ipc_tcp_connection
`ipc_tcp_connection` failed: exit code 6
Output from process `ipc_tcp_connection`:
exit_cb
Assertion failed in test/test-ipc.c on line 359: read2_cb_called == 1
=============================================================
[%  12|+  22|-   3|T   0|S   0]: tcp_ping_pong
`tcp_ping_pong` failed: exit code 6
Output from process `tcp_ping_pong`:
Connect error EIO
Assertion failed in test/echo-server.c on line 150: status == 0
Output from process `tcp_ping_pong`:
PING
Assertion failed in test/test-ping-pong.c on line 69: status == 0
=============================================================
[%  13|+  22|-   4|T   0|S   0]: tcp_ping_pong_v6
`tcp_ping_pong_v6` failed: exit code 6
Output from process `tcp_ping_pong_v6`:
Connect error EIO
Assertion failed in test/echo-server.c on line 150: status == 0
Output from process `tcp_ping_pong_v6`:
PING
Assertion failed in test/test-ping-pong.c on line 69: status == 0
=============================================================
[%  13|+  22|-   5|T   0|S   0]: pipe_ping_pong
`pipe_ping_pong` failed: exit code 6
Output from process `pipe_ping_pong`:
Connect error EIO
Assertion failed in test/echo-server.c on line 150: status == 0
Output from process `pipe_ping_pong`:
PING
Assertion failed in test/test-ping-pong.c on line 69: status == 0
=============================================================
[%  14|+  22|-   6|T   0|S   0]: delayed_accept
`delayed_accept` failed: exit code 6
Output from process `delayed_accept`:
Assertion failed in test/test-delayed-accept.c on line 83: status == 0
=============================================================
[%  14|+  22|-   7|T   0|S   0]: multiple_listen
`multiple_listen` failed: exit code 6
Output from process `multiple_listen`:
Assertion failed in test/test-multiple-listen.c on line 41: status == 0
=============================================================
[%  15|+  22|-   8|T   0|S   0]: tcp_writealot
`tcp_writealot` failed: exit code 6
Output from process `tcp_writealot`:
Connect error EIO
Assertion failed in test/echo-server.c on line 150: status == 0
Output from process `tcp_writealot`:
uv_write error: connection reset by peer
Assertion failed in test/test-tcp-writealot.c on line 101: 0
=============================================================
[%  15|+  22|-   9|T   0|S   0]: tcp_open
`tcp_open` failed: exit code 6
Output from process `tcp_open`:
Connect error EIO
Assertion failed in test/echo-server.c on line 150: status == 0
Output from process `tcp_open`:
uv_write error: connection reset by peer
Assertion failed in test/test-tcp-open.c on line 119: 0
=============================================================
[%  16|+  22|-  10|T   0|S   0]: tcp_shutdown_after_write
`tcp_shutdown_after_write` failed: exit code 6
Output from process `tcp_shutdown_after_write`:
Connect error EIO
Assertion failed in test/echo-server.c on line 150: status == 0
Output from process `tcp_shutdown_after_write`:
lt-run-tests: src/unix/stream.c:1027: uv__read: Assertion `!uv__io_active(&stream->io_watcher, 1) && "stream->read_cb(status=-1) did not call uv_close()"' failed.
=============================================================
[%  22|+  33|-  11|T   0|S   0]: tcp_close
`tcp_close` failed: exit code 6
Output from process `tcp_close`:
Assertion failed in test/test-tcp-close.c on line 75: status == 0
=============================================================
[%  23|+  34|-  12|T   0|S   0]: tcp_write_to_half_open_connection
`tcp_write_to_half_open_connection` failed: exit code 6
Output from process `tcp_write_to_half_open_connection`:
Assertion failed in test/test-tcp-write-to-half-open-connection.c on line 49: status == 0
=============================================================
[%  24|+  34|-  13|T   0|S   0]: tcp_unexpected_read
`tcp_unexpected_read` failed: exit code 6
Output from process `tcp_unexpected_read`:
Assertion failed in test/test-tcp-unexpected-read.c on line 79: 0 == status
=============================================================
[%  24|+  34|-  14|T   0|S   0]: tcp_read_stop
`tcp_read_stop` failed: exit code 6
Output from process `tcp_read_stop`:
Connect error EIO
Assertion failed in test/echo-server.c on line 150: status == 0
Output from process `tcp_read_stop`:
Assertion failed in test/test-tcp-read-stop.c on line 31: 0 && "fail_cb called"
=============================================================
[%  35|+  55|-  15|T   0|S   0]: shutdown_eof
`shutdown_eof` failed: exit code 6
Output from process `shutdown_eof`:
Connect error EIO
Assertion failed in test/echo-server.c on line 150: status == 0
Output from process `shutdown_eof`:
Assertion failed in test/test-shutdown-eof.c on line 57: nread == 1
=============================================================
[%  36|+  55|-  16|T   0|S   0]: callback_stack
`callback_stack` failed: exit code 6
Output from process `callback_stack`:
Connect error EIO
Assertion failed in test/echo-server.c on line 150: status == 0
Output from process `callback_stack`:
Connecting...
Connected. Write some data to echo server...
Assertion failed in test/test-callback-stack.c on line 130: status == 0
=============================================================
[%  62|+ 105|-  17|T   0|S   0]: getsockname_tcp
`getsockname_tcp` failed: exit code 6
Output from process `getsockname_tcp`:
server socket: 0.0.0.0:9123
Connect error EIO
Assertion failed in test/test-getsockname.c on line 116: status == 0
=============================================================
[%  75|+ 129|-  18|T   0|S   0]: signal_multiple_loops 
`signal_multiple_loops` failed: timeout
Output from process `signal_multiple_loops`:
signal1_cb calls: 100
signal2_cb calls: 50
loops created and destroyed: 220151
=============================================================
[%  90|+ 157|-  19|T   0|S   0]: fs_readdir_empty_dir
`fs_readdir_empty_dir` failed: exit code 6
Output from process `fs_readdir_empty_dir`:
Assertion failed in test/test-fs.c on line 1690: r == 0
=============================================================
[% 100|+ 175|-  20|T   0|S   0]: Done.
FAIL: test/run-tests
=======================================================
1 of 1 test failed

Cédric VINCENT

unread,
Oct 11, 2013, 6:50:19 AM10/11/13
to proo...@googlegroups.com
Hello Maxence,

On Fri, Oct 11, 2013 at 10:55 AM, Maxence Dalmais <max...@gmail.com> wrote:
[...]
>> Inside the proot
>> proot -R /
>> $ make check
>> =============================================================
>> [% 10|+ 20|- 0|T 0|S 0]: ipc_listen_before_write
>> `ipc_listen_before_write` failed: exit code 6
>> Output from process `ipc_listen_before_write`:
>> got 6 bytes
>> error recving on channel: connection reset by peer
[...]

I'm able to reproduce this unexpected failure. I'm investing why.

Thanks for your bug report!
Cédric.

Cédric VINCENT

unread,
Oct 11, 2013, 9:39:50 AM10/11/13
to proo...@googlegroups.com
---------- Forwarded message ----------
From: Maxence Dalmais <max...@gmail.com>
Date: Fri, Oct 11, 2013 at 2:37 PM
Subject: Re: libuv inside proot ?
To: cedric....@gmail.com


Hi Cédric,

Thanks for investigating.
By the way, do you know if there is any way to get strace or anything
similar working ?

Max

Cédric VINCENT

unread,
Oct 11, 2013, 9:40:01 AM10/11/13
to proo...@googlegroups.com
---------- Forwarded message ----------
From: maxired <max...@gmail.com>
Date: Fri, Oct 11, 2013 at 3:09 PM
Subject: Re: libuv inside proot ?
To: Cédric VINCENT <cedric....@gmail.com>


Great !
Are you gonna be able to push a quick fix for this specific problem ?

That is good news concerning the ptrace emulator.

I'm just discovering proot, but this is just what I was looking for years !

(Did you choose to send the message off the mailing list ? )

Max



On Fri, Oct 11, 2013 at 2:58 PM, Cédric VINCENT
<cedric....@gmail.com> wrote:
>
> > Thanks for investigating.
>
> You are welcome ! For information, the bug is identified: PRoot
> didn't allow the second argument of accept(2) to be NULL, however this
> is allowed by the kernel:
>
> When addr is NULL, nothing is filled in; in this case, addrlen is
> not used, and should also be NULL.
>
> -- man 2 accept
>
>
> > By the way, do you know if there is any way to get strace or
> > anything similar working ?
>
> The PRoot ptrace emulator -- required to run strace, gdb, proot, and
> any other tools using ptrace -- ought to have been shipped in the next
> release of PRoot (v3.2, this month). Sadly this support is not yet
> ready to be pushed publicly: some versions of strace (>= 4.7) don't
> work and gdb does not exit cleanly. I hope the ptrace emulator will
> be included in PRoot v3.3 (or v4.0).
>
> Regards,
> Cédric.

Cédric VINCENT

unread,
Oct 11, 2013, 9:40:18 AM10/11/13
to proo...@googlegroups.com
---------- Forwarded message ----------
From: maxired <max...@gmail.com>
Date: Fri, Oct 11, 2013 at 3:33 PM
Subject: Re: libuv inside proot ?
To: Cédric VINCENT <cedric....@gmail.com>


Thanks for the patch. I'll test it and let you know !

Sorry, my mistake. Please make everything public ;)


On Fri, Oct 11, 2013 at 3:28 PM, Cédric VINCENT
<cedric....@gmail.com> wrote:
>
> On Fri, Oct 11, 2013 at 3:09 PM, maxired <max...@gmail.com> wrote:
> > Are you gonna be able to push a quick fix for this specific problem ?
>
> Here is the patch, it will be pushed publicly later. I'm currently
> working on another issue exposed by the libuv testsuite.
>
>
> > (Did you choose to send the message off the mailing list ? )
>
> Not really, actually your second mail was off the mailing-list, so was
> my reply. Do you mind if I forward the missing part of this thread to
> the mailing-list?
>
> Cédric

Cédric VINCENT

unread,
Oct 11, 2013, 9:42:35 AM10/11/13
to proo...@googlegroups.com
---------- Forwarded message ----------
From: Cédric VINCENT <cedric....@gmail.com>
Date: Fri, Oct 11, 2013 at 2:58 PM
Subject: Re: libuv inside proot ?

Cédric VINCENT

unread,
Oct 11, 2013, 9:42:46 AM10/11/13
to proo...@googlegroups.com
---------- Forwarded message ----------
From: Cédric VINCENT <cedric....@gmail.com>
Date: Fri, Oct 11, 2013 at 3:28 PM
Subject: Re: libuv inside proot ?
proot-libuv.patch

Maxence Dalmais

unread,
Oct 13, 2013, 2:08:57 PM10/13/13
to proo...@googlegroups.com
I applied this patch on top of proot 3.1 (https://github.com/cedric-vincent/PRoot/commit/086eaab14e5155d41e5ae9cfad79dfd77110aaf6), and it works great.

There is only one libuv test failing, and it's not related to sockets.

I have been able to run successfully a NodeJS server.




Cédric VINCENT

unread,
Oct 14, 2013, 2:38:34 AM10/14/13
to proo...@googlegroups.com
On Sun, Oct 13, 2013 at 8:08 PM, Maxence Dalmais <max...@gmail.com> wrote:
> I applied this patch on top of proot 3.1
> (https://github.com/cedric-vincent/PRoot/commit/086eaab14e5155d41e5ae9cfad79dfd77110aaf6),
> and it works great.
>
> There is only one libuv test failing, and it's not related to sockets.

I guess you were talking about the "fs_readdir_empty_dir" test case.
The fix will be included in the next release.


> I have been able to run successfully a NodeJS server.

Good news! For information, I added libuv's test suite to the PRoot
validation process.

Regards,
Cédric.
Reply all
Reply to author
Forward
0 new messages