Serial.println() duplicated in web editor?

HI all!

I'm testing a simplest app in Web Edtior with my Arduino Leonardo (actually MakeyMakey):

int tick = 1;
String m = "tick ";

void setup() {
    
}

void loop() {
  Serial.println(m + tick);
  tick = -tick;
  delay(1000);
}

And surprisingly, the output in Monitor panel is:

tick -1
tick -1
tick 1
tick 1
tick -1
tick -1
tick 1
tick 1
tick -1
tick -1

And so on.

Is this a bug or something else? Maybe I misunderstand how it should work?

FYI, checked with a serial terminal app and I saw correct output:
tick 1
tick -1
tick 1
… etc
So looks like it’s a but in Web Editor or Windows Create Agent.

I’m using Windows 10 x64, Agent 1.1.69-6d4a183, browser is Chrome Canary 69.0.3444.0

I tried your sketch with a Leonardo and the output is correct

I was having the same problem, but using the cloud interface. I'm working with a Raspberry Pi and started seeing duplications of every line, so I tried the very simple sketch posted by gdsports at https://forum.arduino.cc/index.php?topic=534977.msg3649605#msg3649605 and continued to see the duplicated output.

Code:

void setup() {
  CloudSerial.begin(115200);
}

uint32_t loopCount=0;

void loop() {
  CloudSerial.print("hello ");
  CloudSerial.println(loopCount++);
  delay(1000);
}

Serial output:

hello 1
hello 1
hello 2
hello 2
helhello 3
lo 3
hello 4
hello 4
hello 5
hello 5
hello 6
hello 6
hello 7
hello 7
hello 8
hello 8
hhello 9
ello 9

I also saw "hello 0" show up twice and then get overwritten by the "hello 1" lines.

Then, I opened the developer tools in Chrome to look for Javascript errors, cleared the console, and reloaded the webpage to capture fresh data. Unexpectedly, my serial output was fixed! I'm only getting one of everything in every sketch I try, although the printing seems to be quite slow.

tldr: I had the same problem and refreshing the web page fixed it, mysteriously.

I also had this problem - and it included printing twice not only in the serial monitor but in the console when uploading new code, etc.

As per abigail-rolling, doing a full cache clear refresh in the browser magically fixed it.

I reproduced the issue, report here

I published a fix, could you please report it, if it happens again? Thanks