To Reproduce:
- Open a Julia file in a fresh atom
- run the julia-client "toggle console" command
- type
1+1
in the console and press enter
- While that's chugging away move the cursor around a few times by clicking inside the Julia file
- Bang. Exception.
When I run that sequence with a breakpoint on tcp.coffee:12 I see the first time it's called everything is fine (at least it doesn't thrown an exception), but the 2nd time str
ends up with the value
"[3,{"inactive":false,"sub":"AudioIO","subInactive":true,"main":"Main"}]["result",{"error":false,"result":"2"}]
[1,null]
"
So then lines
ends up being a 5-element array with some empty strings and the first element had two JSON lists that aren't newline separated. At this point buffer
still has the first element of "[2,{"inactive":false,"sub":"AudioIO","subInactive":true,"main":"Main"}]"
(the last item that got put in there?) So when it hits the code buffer[0] += lines.shift()
, the first element of the buffer actually ends up having 3 JSON lists smushed up against each other. Then when it tries to call f
on that string (which tries to parse it) then it throws the exception, probably on the opening bracket of the 2nd smushed message.
So as far as I can tell there are 2 bugs here:
- We're getting malformed data over the TCP string, possibly from interleaved tasks on the Julia side (total guess)
- when the receiver task gets called on the Atom side, there is sometimes still data in the first element of the buffer, so the incoming data just gets appended to it
I think after the first exception gets called here, buffer
is hosed and has empty strings in it, which is what then causes #18.
Atom Version: 1.0.11
System: Mac OS X 10.10.4
Thrown From: julia-client package, v0.1.2
Stack Trace
Uncaught SyntaxError: Unexpected token [
At file:///Applications/Atom.app/Contents/Resources/app.asar/static/index.html#%7B%22locationsToOpen%22%3A%5B%7B%22pathToOpen%22%3A%22%2FUsers%2Fsrussell%2F.julia%2Fv0.4%2FAudioIO%22%7D%5D%2C%22bootstrapScript%22%3A%22%2FApplications%2FAtom.app%2FContents%2FResources%2Fapp.asar%2Fsrc%2Fwindow-bootstrap.js%22%2C%22resourcePath%22%3A%22%2FApplications%2FAtom.app%2FContents%2FResources%2Fapp.asar%22%2C%22devMode%22%3Afalse%2C%22safeMode%22%3Afalse%2C%22appVersion%22%3A%221.0.11%22%2C%22shellLoadTime%22%3A984%2C%22initialPaths%22%3A%5B%22%2FUsers%2Fsrussell%2F.julia%2Fv0.4%2FAudioIO%22%5D%7D:1
SyntaxError: Unexpected token [
at Object.parse (native)
at /Users/srussell/dotfiles/.atom/packages/julia-client/lib/connection/tcp.coffee:36:27
at Socket.<anonymous> (/Users/srussell/dotfiles/.atom/packages/julia-client/lib/connection/tcp.coffee:17:9)
at emitOne (events.js:77:13)
at Socket.emit (events.js:166:7)
at readableAddChunk (_stream_readable.js:146:16)
at Socket.Readable.push (_stream_readable.js:109:10)
at TCP.onread (net.js:517:20)
Commands
-0:27.1.0 command-palette:toggle (atom-text-editor.editor.vim-mode.normal-mode.is-focused)
6x -0:22.6.0 core:move-down (atom-text-editor.editor.mini.is-focused)
-0:21.4.0 core:confirm (atom-text-editor.editor.mini.is-focused)
-0:21.3.0 julia-client:toggle-console (atom-text-editor.editor.vim-mode.normal-mode)
-0:16.9.0 console:evaluate (atom-text-editor.editor.is-focused)
-0:16.9.0 julia-client:start-julia (atom-workspace.workspace.scrollbars-visible-when-scrolling.theme-one-dark-syntax.theme-one-dark-ui)
Config
{
"core": {},
"julia-client": {
"juliaPath": "/usr/local/bin/julia4"
}
}
Installed Packages
# User
atom-yeoman, v0.3.13
autocomplete-bibtex, v0.6.1
autocomplete-clang, v0.8.7
autocomplete-julia, v0.1.0
build-tools, v3.7.0
ink, v0.1.1
json-schema, v0.1.13
julia-client, v0.1.2
language-cmake, v0.1.4
language-julia, v0.4.1
language-latex, v0.6.1
latex-completions, v0.3.0
linter, v1.5.0
markdown-preview-katex, v0.3.4
markdown-scroll-sync, v0.4.2
minimap, v4.13.2
pdf-view, v0.23.0
vim-mode, v0.59.0
vim-surround, v0.8.0
wordcount, v2.3.0
zentabs, v0.8.6
# Dev
No dev packages