Character limit bug in Interpreter

For some reason, code blocks that are 253 characters or more stop working for me when the server is booted. Everything works as normal when restarting the interpreter without the server (but obviously this is not ideal).

I created a bug report on GitHub that has a little more info: Code stops working after hitting 252 characters · Issue #6081 · supercollider/supercollider · GitHub

Here’s another example of some code and its error message:

(
var freq1 = rrand(200,400);
var freq2 = freq1 * 1.5;
var freq3 = freq2 * 2.25;
{LFPulse.ar([freq1,freq1],0,MouseX.kr(0.125,0.25),MouseY.kr(0,0.33))}.play;
{LFPulse.ar([freq2,freq2],0,MouseX.kr(0.25,0.5),MouseY.kr(0,0.33))}.play;
{LFPulse.ar([freq2,freq2],0,MouseX.kr(0.5,1),MouseY.kr(0,0.33))}.play;
)
ERROR: syntax error, unexpected ',', expecting end of file
  in interpreted text
  line 1 char 1:

  ,0,MouseX.kr(0.5,1),MouseY.kr(0,0.33))}.play;
  ^
  ) 
-----------------------------------
ERROR: Command line parse failed

It usually points towards something near the end of the code block, says its in line 1, and says that it expected the end of the file.

Unfortunately, there have been strange interprocess problems in Windows (but not other platforms). These have been difficult to troubleshoot because they are often not reproducible on other machines (or if not, then sometimes they are sporadic = difficult to reproduce on demand).

I don’t remember seeing any reports of this specific bug before… so unfortunately, I don’t have a solution at hand.

What is suggestive about this report is:

"(
var freq1 = rrand(200,400);
var freq2 = freq1 * 1.5;
var freq3 = freq2 * 2.25;
{LFPulse.ar([freq1,freq1],0,MouseX.kr(0.125,0.25),MouseY.kr(0,0.33))}.play;
{LFPulse.ar([freq2,freq2],0,MouseX.kr(0.25,0.5),MouseY.kr(0,0.33))}.play;
{LFPulse.ar([freq2,freq2],0,MouseX.kr(0.5,1),MouseY.kr(0,0.33))}.play;
)".drop(256);

-> ,0,MouseX.kr(0.5,1),MouseY.kr(0,0.33))}.play;
)

So the code sent to the compiler is your block, minus the first 256 characters. This could happen, for instance, if the interprocess socket is chunking the characters into groups of 256, and (somehow) losing all but the last chunk. I have no explanation why this would happen only after booting the server – there’s no good reason why that should be (or for that matter, 256-byte chunks? in 2023? something fishy there), and in other Windows environments, this doesn’t happen (so the cause is not 100% in our code base – the code works on some machines but not others… phhffffttt…).

Would you mind, as a test, running the internal server instead? The internal server’s status doesn’t show in the IDE window (because the internal server doesn’t open a UDP socket for OSC messages), but there is an alternate status window:

Server.default = s = Server.internal;

s.makeGui;

I’m curious if it will make a difference when the IDE is not directly communicating with the server.

hjh

So the code sent to the compiler is your block, minus the first 256 characters. This could happen, for instance, if the interprocess socket is chunking the characters into groups of 256, and (somehow) losing all but the last chunk.

This may be the case. I just did some more testing with long strings and integers:

//3456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
12345678901234567890;

…which yields 67890 as the sole output. This would put a cutoff point around the 256th character.

Running the internal server did not seem to make a difference, even after rebooting the interpreter.

Drat.

Unfortunately, I’m out of ideas at this point.

hjh

So I have some updates on the weird problems I’ve been having with the IDE:

I was able to figure out that it was the IDE that was the issue; typing the code myself into scsynth.exe works fine. I’ve currently been using a program called Pulsar with a package for communicating with scsynth.exe.

Here’s the interesting part: As I mentioned earlier, the problems only start happening when I boot the server through the IDE. However, if I boot the server through Pulsar, the code works just fine, sound and all. Not sure what could be causing this but this may help pinpoint the issue?