Cloud9 execution is flaky

I noticed both in the firmware that shipped with BBBlack A5A and in the new 5/8/2013 firmware, the Cloud9 IDE doesn’t always seem to execute my code. This is consistent across 2 different BBBlack’s too.

Very simple app, one of the examples in fact:

var b=require(‘bonescript’);
b.pinMode(‘USR0’, ‘out’);
b.pinMode(‘USR1’, ‘out’);
b.pinMode(‘USR2’, ‘out’);
b.pinMode(‘USR3’, ‘out’);
b.digitalWrite(‘USR0’, 0);
b.digitalWrite(‘USR1’, 0);
b.digitalWrite(‘USR2’, 0);
b.digitalWrite(‘USR3’, 0);

Sometimes when I hit the play/debug button it runs and all the LEDs shut off, then I reset it (hitting the button on the bonescript example page that comes with its webserver) and try running play/debug again, this time it hangs (I see the stop button in place of the play/debug button) with no effects.

The IDE is running the program as “ps auxwww | grep node” shows:

root@beaglebone:~# ps auxwww | grep node
root 129 0.1 1.8 38996 9276 ? Ssl 00:00 0:01 /usr/bin/node autorun.js
root 130 2.2 3.5 57984 18160 ? Ssl 00:00 0:31 /usr/bin/node4 /usr/share/cloud9/bin/cloud9.js -l 0.0.0.0 -w /var/lib/cloud9 -p 3000
root 616 0.6 5.7 49612 29404 ? Ssl 00:01 0:09 /usr/bin/node server.js
root 1123 7.1 1.7 50676 8756 ? Sl 00:14 0:35 node --debug-brk=6066 /var/lib/cloud9/eric/ledoff.js
root 1151 0.0 0.1 1960 612 pts/0 S+ 00:22 0:00 grep node

Journalctl shows:

Jan 01 00:13:07 beaglebone node4[130]: Executing node node --debug-brk=6563 /var/lib/cloud9/eric/ledoff.js /var/lib/cloud9/
Jan 01 00:13:07 beaglebone node4[130]: publish state{“type”:“state”,“pythonProcessRunning”:false,“nodeDebugClient”:true,“nodeProcessRunning”:true,"workspace
Jan 01 00:14:30 beaglebone node4[130]: Executing node node --debug-brk=6066 /var/lib/cloud9/eric/ledoff.js /var/lib/cloud9/
Jan 01 00:14:30 beaglebone node4[130]: publish state{“type”:“state”,“pythonProcessRunning”:false,“nodeDebugClient”:true,“nodeProcessRunning”:true,"workspace
Jan 01 00:14:30 beaglebone node4[130]: uncaught exception:
Jan 01 00:14:31 beaglebone node4[130]: Error: Socket is not writable
Jan 01 00:14:31 beaglebone node4[130]: at Socket._writeOut (net.js:391:11)
Jan 01 00:14:31 beaglebone node4[130]: at Socket.write (net.js:377:17)
Jan 01 00:14:31 beaglebone node4[130]: at [object Object].send (/usr/share/cloud9/support/lib-v8debug/lib/v8debug/NodeSocket.js:97:22)
Jan 01 00:14:31 beaglebone node4[130]: at [object Object].$send (/usr/share/cloud9/support/lib-v8debug/lib/v8debug/StandaloneV8DebuggerService.js:67:22)
Jan 01 00:14:31 beaglebone node4[130]: at [object Object].debuggerCommand (/usr/share/cloud9/support/lib-v8debug/lib/v8debug/StandaloneV8DebuggerService.js:
Jan 01 00:14:31 beaglebone node4[130]: at [object Object].send (/usr/share/cloud9/server/cloud9/ext/run-node/nodedebugproxy.js:40:22)
Jan 01 00:14:31 beaglebone node4[130]: at [object Object].command (/usr/share/cloud9/server/cloud9/ext/run-node/run-node.js:95:41)
Jan 01 00:14:31 beaglebone node4[130]: at [object Object].execHook (/usr/share/cloud9/server/cloud9/workspace.js:47:58)
Jan 01 00:14:31 beaglebone node4[130]: at [object Object].onUserMessage (/usr/share/cloud9/server/cloud9/ide.js:317:24)
Jan 01 00:14:31 beaglebone node4[130]: at [object Object]. (/usr/share/cloud9/server/cloud9/ide.js:256:23)
Jan 01 00:14:35 beaglebone node4[130]: Running user disconnect timer…
Jan 01 00:14:37 beaglebone node4[130]: publish state{“type”:“state”,“pythonProcessRunning”:false,“nodeDebugClient”:true,“nodeProcessRunning”:true,"workspace
Jan 01 00:14:37 beaglebone node4[130]: publish state{“type”:“state”,“pythonProcessRunning”:false,“nodeDebugClient”:true,“nodeProcessRunning”:true,"workspace
Jan 01 00:14:37 beaglebone node4[130]: publish state{“type”:“state”,“pythonProcessRunning”:false,“nodeDebugClient”:true,“nodeProcessRunning”:true,"workspace
Jan 01 00:14:37 beaglebone node4[130]: publish state{“type”:“state”,“pythonProcessRunning”:false,“nodeDebugClient”:true,“nodeProcessRunning”:true,"workspace

Looks like it spends a minute and a half or so and then dumps some errors.

Running the command direct from SSH session works:

root@beaglebone:~# node /var/lib/cloud9/eric/ledoff.js

root@beaglebone:~#
(LEDs are off now)

FYI I have the impression now that this is a race condition. Stopping the cloud9 service and running it manually through “strace” slows down the IDE quite a bit, and in that state, the debug mode works perfectly every time.

root@beaglebone:~# strace -o file -ff /usr/bin/node4 /usr/share/cloud9/bin/cloud9.js -l 0.0.0.0 -w /var/lib/cloud9 -p 3000
info - socket.io started

. …__%|iiiiiii=>,…
<iIIviiiiiiiiiillli<.
.ivIvilli%||+++++|iillllvs;_
…nvlIlv|~`… -<*IIIvv=
.)nvvvvv-… . … … ~nvvvo=.
.i<vvvvn(= . . …i>, . … +)nnnv…
_i%vvvvllIIlIlIvIvvv( … . lnnsi . :)vnvnsissvisi>
.
.<vnvvvvvvIvvvvvvvlvvII;. . |nnvv: . . -)lvvlIIIIlvvIvnnns=_.
.:vnvvvvvvvvvvvvvIvIvIIvv>: . . . |{}l. . :<lvIvvvvvvvvvvvvvvnov.

)nvnvnvnvnvnvvvvvvvvvvvvis . . . =ivvvvvvvvvvvnvnvnvnvnn…
.nnnnnnvnnvnvnvnvvvnvvvvvvvnv_ . . :vnvvvvvvvnvnnvnnnnnnnnov;
:2oonnnnnnnnnvnvnnvnvvnvvvvvIvvi==i… . .vvvvvvvvnvnnvnnnnnnnnooooc
:nnooonnnnnnnnnnvvnvvvvvvvvIvIlIvvnI- .=vvvvvvvvnvnvnnnnnnnnnnooo2(
{XooooonnnnnvnvnvvvvvvvIIIIIIIIv|- .<vIlIIvIvvvvvnvvnvnnnnnooo2v(
.){2ooooonnnnvnvnvvvvvIIIIIIlll± . =)lllIIvIvvvvvvvnvnnnvnnooo22-`
-{2oooonnnnnvvvvvvvlIIlllllil==
._iIllillllllIvvvvvvnvnnnnoooo*-
. -.“11oonnvvvnvvIIlIlliliiiiillii||iliiiiiiililllIIvvvvvnnnnn2}(~.
. -+~!lvvnvIvIIllliiiii|i|||i||i|||i||iiiiilillIIvvvvvv}|”- .
. …–~++++++++~+~+~+~±±+~+~±+~+~++~++++++~~~-:… .
. . . . … . . … … … … … . . . .

Ajax.org Cloud9 IDE
version 0.6
Project root is: /var/lib/cloud9
Point your browser to http://localhost:3000
publish state{“type”:“state”,“pythonProcessRunning”:false,“nodeDebugClient”:false,“nodeProcessRunning”:false,“workspaceDir”:“/var/lib/cloud9”}
publish state{“type”:“state”,“pythonProcessRunning”:false,“nodeDebugClient”:false,“nodeProcessRunning”:false,“workspaceDir”:“/var/lib/cloud9”}
Executing node node --debug-brk=6474 /var/lib/cloud9/ledon.js /var/lib/cloud9/
publish state{“type”:“state”,“pythonProcessRunning”:false,“nodeDebugClient”:true,“nodeProcessRunning”:true,“workspaceDir”:“/var/lib/cloud9”}
Executing node node --debug-brk=5968 /var/lib/cloud9/ledon.js /var/lib/cloud9/
publish state{“type”:“state”,“pythonProcessRunning”:false,“nodeDebugClient”:true,“nodeProcessRunning”:true,“workspaceDir”:“/var/lib/cloud9”}
Executing node node --debug-brk=6792 /var/lib/cloud9/ledon.js /var/lib/cloud9/
publish state{“type”:“state”,“pythonProcessRunning”:false,“nodeDebugClient”:true,“nodeProcessRunning”:true,“workspaceDir”:“/var/lib/cloud9”}

The journalctl errors mentioned in my previous post give a hint as to where it might be. I just don’t know enough about how the Javascript debugger in cloud9 works to try figuring it out.

I’ve had a few issues with the Cloud9 IDE as well where it wouldn’t run my program… or it would run a different program. For the time being, I had resorted to running my scripts from the command-line.

When I get my board back and some time, I was considering seeing if it was possible to use the BeagleScript server to push code from a remote Eclipse session.

~ Jason

It looks like there is a gear icon in the “Run” mode that lets you disable debugging, so it runs directly, and that works. Just debug mode is broken. So at least the IDE is usable…

Off topic, the IDE’s color scheme is horrible! I could not see the preferences (gear icon) in the Run mode pane on the left side until I accidentally tilted my monitor toward me and noticed the different shades. Themes only seem to affect the coloring of the code. Nasty!