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

sclang interpret string size limit #33

Open
ifranco opened this issue Aug 23, 2017 · 11 comments
Open

sclang interpret string size limit #33

ifranco opened this issue Aug 23, 2017 · 11 comments

Comments

@ifranco
Copy link

ifranco commented Aug 23, 2017

Hello,
I've been using supercollider.js to build a new web editor for Prynth. I've implemented block evaluation, like in SC IDE, via a call of the .interpret method.
Apparently there is a limit to the size of the string that can be passed to interpret...
Can you confirm this?
If this is a reserved size for the string, can it be increased in order to evaluate bigger chunks of code?

Thanks,
Ivan

@crucialfelix
Copy link
Owner

crucialfelix commented Aug 24, 2017

Of the top of my head I think sclang has a limitation. But that's like 32k

How big is your string ?

@ifranco
Copy link
Author

ifranco commented Aug 24, 2017 via email

@crucialfelix
Copy link
Owner

crucialfelix commented Aug 24, 2017 via email

@ifranco
Copy link
Author

ifranco commented Aug 24, 2017 via email

@crucialfelix
Copy link
Owner

Let me try it. Sorry I've been quite busy this last week.

@ifranco
Copy link
Author

ifranco commented Sep 5, 2017

Hi Chris,
have you had an opportunity to look at it? Have you been able to reproduce the same error?

Thanks,
Ivan

@crucialfelix
Copy link
Owner

I am trying with strings as large as 221k and it is still correctly returning a SyntaxError for me.

Can you post the code or at least something that shows what it is ? a gist or pastebin would be fine. There is some syntax error in there but I don't know why it returns nothing in the code slot of the error.

I do notice that you have a printer quote in there "code":"” which is weird

@woolgathering
Copy link

I can't help but think that this and crucialfelix/atom-supercollider#71 are related. I ran into the issue again yesterday and have tried to find what might be happening. I'm getting the exact same callback error as @ifranco so I followed it down.

The string that is meant for interpreting is fine and complete up through the call to SuperColliderJS.interpret in the write function in sclang.js (src/lang/sclang.js, line 379 and its analogue in lib/lang/sclang.js in the atom-supercollider package). Inside SuperColliderJS, the string is truncated to the spot that throws the error, for me, at 8189 characters every time. So something is happening with the call to SuperColliderJS.interpret that is truncating the string.

After reading a bit more, I have a hunch that it might have to do with a UDP data length limit of 65,507 bytes (8188 UTF-8 characters... Coincidence?). But I don't know why it would work in the SC-IDE or enough about UDP to go any further. To be honest, I'm pretty sure atom-supercollider is using UDP to talk to sclang but I'm not even 100% certain.

Correct me if I'm totally off base. I'd really like to help get this going since it's a serious obstacle in my workflow.

@crucialfelix
Copy link
Owner

crucialfelix commented Oct 30, 2017

It's not using a socket (UDP or TCP) at all. It is connected directly to the standard out / standard in of the sclang process. So it is in all likelihood a problem with sclang posting too much stuff and messing it up. I've seen that happen. JMC decided the music was the important thing and if the post buffer is too big or filling too fast then it just doesn't bother to print it all.

There is a PR here: #37 that DOES solve it. It uses a TCP socket. I want to test and merge it, but there are issues to solve with running multiple sclang (which I have done often). But it should be a more stable communication channel.

@ifranco
Copy link
Author

ifranco commented Oct 30, 2017 via email

@woolgathering
Copy link

Yes, my problem seems identical to @ifranco; i.e. it's not a posting problem as there is no execution. I tested the string meant for interpreting by writing it to a file in SuperColliderJS.interpret. Immediately before the method is called, it writes in its entirety but within the *.interpret method, it is truncated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants