Arduino 1.8.2 w/ Travis CI causes many warnings, 1.8.1 and older does not. Why?

I've been working on setting up Travis CI in some of my repositories to do automatic test builds. I found that verifying sketches and some other actions using Arduino IDE 1.8.2 or the hourly build causes Travis CI to generate many warnings:

$ arduino --verify --board arduino:avr:uno /usr/local/share/arduino/examples/01.Basics/Blink/Blink.ino

Picked up JAVA_TOOL_OPTIONS: 

Loading configuration...

Initializing packages...

Preparing boards...

Verifying...

[SocketListener(testing-gce-3a4a3a56-66ce-4bae-a33c-0e3f45b5555e-c-travis-ci-prod-5-internal.local.)] WARN javax.jmdns.impl.DNSIncoming$MessageInputStream - bad domain name: possible circular name detected. Bad offset: 0x3fff at 0x72

[SocketListener(testing-gce-3a4a3a56-66ce-4bae-a33c-0e3f45b5555e-c-travis-ci-prod-5-internal.local.)] WARN javax.jmdns.impl.constants.DNSRecordType - Could not find record type for index: 65535

[SocketListener(testing-gce-3a4a3a56-66ce-4bae-a33c-0e3f45b5555e-c-travis-ci-prod-5-internal.local.)] WARN javax.jmdns.impl.DNSIncoming - Could not find record type: dns[query,10.10.8.142:5353, length=116, id=0x0]

   0: 0000000000010000 000100004c746573 74696e672d676365 2d33613461336135     ........ ....Ltes ting-gce -3a4a3a5

  20: 362d363663652d34 6261652d61333363 2d30653366343562 35353535652d632d     6-66ce-4 bae-a33c -0e3f45b 5555e-c-

  40: 7472617669732d63 692d70726f642d35 2d696e7465726e61 6c056c6f63616c00     travis-c i-prod-5 -interna l.local.

  60: 00ff0001c00c0001 000100000e100004 0a0a088e                              ........ ........ ....

[SocketListener(testing-gce-3a4a3a56-66ce-4bae-a33c-0e3f45b5555e-c-travis-ci-prod-5-internal.local.)] WARN javax.jmdns.impl.constants.DNSRecordClass - Could not find record class for index: 65535

[SocketListener(testing-gce-3a4a3a56-66ce-4bae-a33c-0e3f45b5555e-c-travis-ci-prod-5-internal.local.)] WARN javax.jmdns.impl.DNSIncoming$MessageInputStream - bad domain name: possible circular name detected. Bad offset: 0x3fff at 0x72

[SocketListener(testing-gce-3a4a3a56-66ce-4bae-a33c-0e3f45b5555e-c-travis-ci-prod-5-internal.local.)] WARN javax.jmdns.impl.constants.DNSRecordType - Could not find record type for index: 65535

[SocketListener(testing-gce-3a4a3a56-66ce-4bae-a33c-0e3f45b5555e-c-travis-ci-prod-5-internal.local.)] WARN javax.jmdns.impl.DNSIncoming - Could not find record type. domain: 

dns[query,10.10.8.142:5353, length=116, id=0x0, questions=1

questions:

 [DNSQuestion@1606642947 type: TYPE_IGNORE index 0, class: CLASS_UNKNOWN index 0, name: gce-3a4a3a56-66ce-4bae-a33c-0e3f45b5555e-c-tr.ci-prod-5-internallocalϰ

ï.]]

 question:      [DNSQuestion@1606642947 type: TYPE_IGNORE index 0, class: CLASS_UNKNOWN index 0, name: gce-3a4a3a56-66ce-4bae-a33c-0e3f45b5555e-c-tr.ci-prod-5-internallocalϰ

ï.]

   0: 0000000000010000 000100004c746573 74696e672d676365 2d33613461336135     ........ ....Ltes ting-gce -3a4a3a5

  20: 362d363663652d34 6261652d61333363 2d30653366343562 35353535652d632d     6-66ce-4 bae-a33c -0e3f45b 5555e-c-

  40: 7472617669732d63 692d70726f642d35 2d696e7465726e61 6c056c6f63616c00     travis-c i-prod-5 -interna l.local.

  60: 00ff0001c00c0001 000100000e100004 0a0a088e                              ........ ........ ....

[SocketListener(testing-gce-3a4a3a56-66ce-4bae-a33c-0e3f45b5555e-c-travis-ci-prod-5-internal.local.)] WARN javax.jmdns.impl.constants.DNSRecordClass - Could not find record class for index: 65535

[SocketListener(testing-gce-3a4a3a56-66ce-4bae-a33c-0e3f45b5555e-c-travis-ci-prod-5-internal.local.)] WARN javax.jmdns.impl.DNSIncoming - Could not find record class. domain:  type: TYPE_IGNORE index 0

dns[query,10.10.8.142:5353, length=116, id=0x0, questions=1

questions:

 [DNSQuestion@1606642947 type: TYPE_IGNORE index 0, class: CLASS_UNKNOWN index 0, name: gce-3a4a3a56-66ce-4bae-a33c-0e3f45b5555e-c-tr.ci-prod-5-internallocalϰ

ï.]]

 question:      [DNSQuestion@1606642947 type: TYPE_IGNORE index 0, class: CLASS_UNKNOWN index 0, name: gce-3a4a3a56-66ce-4bae-a33c-0e3f45b5555e-c-tr.ci-prod-5-internallocalϰ

ï.]

   0: 0000000000010000 000100004c746573 74696e672d676365 2d33613461336135     ........ ....Ltes ting-gce -3a4a3a5

  20: 362d363663652d34 6261652d61333363 2d30653366343562 35353535652d632d     6-66ce-4 bae-a33c -0e3f45b 5555e-c-

  40: 7472617669732d63 692d70726f642d35 2d696e7465726e61 6c056c6f63616c00     travis-c i-prod-5 -interna l.local.

  60: 00ff0001c00c0001 000100000e100004 0a0a088e                              ........ ........ ....

Sketch uses 928 bytes (2%) of program storage space. Maximum is 32256 bytes.

Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.

Minimal test build with Arduino IDE 1.8.2:

Minimal test build with hourly build of the Arduino IDE:

Note that I'm not referring to the usual warnings output by the compiler during compilation. I don't see any problems when I run the equivalent commands from the command line using these IDE versions on my Windows machine.

arduino --install-boards actions cause the same sort of warnings in Travis CI builds, even when installing the official Arduino packages such as Arduino SAM Boards, Arduino SAMD Boards, etc. arduino --pref and arduino --get-pref do not cause the warnings.

Using Arduino IDE 1.8.1 or older there are no warnings:

It doesn't cause the build to fail but it makes it very difficult to read the output, especially for a more complex build. I have no prior experience with Travis CI.

Is this caused by a bug in the Arduino IDE? Are there any changes I can make to my .travis.yml file to fix or at least hide these warnings?

Related issue report: SocketListener warnings in Travis log when using Arduino IDE 1.8.2 · Issue #1 · per1234/arduino-ci-script · GitHub

Bump. The problem still occurs with Arduino IDE 1.8.3.

This is really a big problem because it makes the logs extremely difficult to read and also can cause Travis CI builds to fail when the log exceeds the maximum limit. I've spent a lot of time looking for a solution but have not found anything. I'd be very grateful if someone could help me out with this.

This issue affects anyone using Travis CI to test Arduino projects so it's a problem for the entire community. I have been doing a lot of work to make it easier for people to use Travis CI with Arduino projects (arduino-ci-script) and I will definitely share any fix that is found with other projects that it affects, not only my own.

I'm seeing the same thing with 1.8.5. I thought perhaps the problem was that it was trying to do a DNS lookup as part of performing an check for updated packages, so I tried suppressing the message with "--pref update.check=false", but this didn't help.

I never found a solution and it's still a huge problem for me. I don't understand it enough to know where I could look for help. I don't know whether this is caused by a bug in the Arduino IDE that was introduced in 1.8.2 or if the Arduino IDE is behaving correctly and I need to look for a solution in Travis CI or some of the software running in that environment. I just need to find a way to suppress these spurious warnings without affecting the useful output.

I'd really appreciate any advice anyone can give on this. I'm getting caught up on work and am hoping to dedicate some blocks of time to the Arduino project soon and this is a high priority for me.

A test that I would suggest is redirecting all of the output from the arduino program, to confirm that the messages are coming from arduino (as it appears) and not from Travis.

If the messages are coming from arduino, then it would be possible to create a workaround in the form of a program (e.g. python script) that suppresses the WARN messages we don't care about.

I'd also suggest filing an issue on github against arduino/Arduino. I did look at the changes git log for the changes between 1.8.1 and 1.8.2. The only commit that stood out as vaguely related was this:

commit e9e24bd369ba213fee101f051215019970ed2611
Merge: 7434443 b2241da
Author: Martino Facchin <m.facchin@arduino.cc>
Date:   Fri Feb 10 18:36:14 2017 +0100

    Merge pull request #5879 from facchinm/better-mdns
    
    Update jmdns to 3.5.1

Thanks jamessynge!

I did a test with the beta build of the Arduino IDE, which has a commit intended to partially solve arduino/Arduino#6832:

and the warnings still appear.

arduino/Arduino#6832 also recommends updating jmdns to 3.5.3, which has not yet happened, so maybe that will make the warnings go away when it does happen.

I agree that arduino/Arduino#5879 seems the likely culprit. Not only did it update jmdns, it also is "using some new features of jmdns". I suspect one of those changes is the actual cause of the warning, in which case the jmdns update will likely not make the warnings go away. To verify I suppose I'll need to change the script to systematically revert those commits and build the IDE from source.

Again, I'm not knowledgeable enough to know whether these warnings represent a bug that should be fixed or if it's just the expected and correct behavior based on some restriction of the Travis CI environment. Pinpointing the change that introduced the warning will bring me closer to understanding what's happening.

Fixing the cause of the warning would be nice but my intent is to allow testing for backwards compatibility so the problem would still remain for all existing IDE releases after 1.8.1. Arduino IDE 1.8.5 will likely be considered a "significant" version for backwards compatibility testing since the 1.9.0 release will introduce major changes so I foresee myself using that release in the tests of my own projects. For that reason suppressing the warning output is a higher priority for me and probably more attainable at my skill level. The warning does not appear when stderr from the verification is redirected to /dev/null:

but of course I need the rest of the stderr output. I think you made a good suggestion about filtering the warnings. I would prefer to find a way to turn them off but that might not be possible.

I've added a filter for the output of the arduino command using regular expressions. A little bit of garbage still slips through but it makes a huge improvement in log readability and size:

Not any ideal solution but certainly better than nothing.

Sorry for bringing back an old thread, but I've run into this issue and am struggling to find a solution (other than using Arduino IDE v1.8.1 in my tests).

Is it possible/likely that this issue is caused by network discovery? That seems to be the IDE component which uses jmdns:

I'm wondering if the pseudo-randomness of the glitch occurring is because discovery only kicks in after a short time (so quick things like --save-prefs commands are fine, but longer-running commands such as --verify or --install-board encounter the problem).

It seems like in an environment like Travis there's not really any point doing network or serial discovery, but there is no way to disable it.

A request was raised in 2016 for a preference setting to disable network and serial discovery, but it is still open:

Is it worth trying to get that request some more visibility?

benlye:
A request was raised in 2016 for a preference setting to disable network and serial discovery, but it is still open:
[Improvement] - Add option to enable/disable network/serial discovery · Issue #4569 · arduino/Arduino · GitHub

Is it worth trying to get that request some more visibility?

It would be interesting to try the modified IDE version that was linked from that issue report by facchinm. Unfortunately the test builds of that PR have since been deleted so it would need to be built from source. That shouldn't be too difficult if you follow these instructions:

I think if you could provide definite proof of the additional benefit (beyond CPU usage reduction) of fixing these warnings, that would give good motivation for #4569 to have higher priority. It seems like right now it's not considered very important.

I noticed that none of Arduino's Travis CI builds have these warnings:

but I haven't investigated to see what's going on there. They don't use symlinks to the IDE, which may be a factor in the warnings. In my case, I do sort of need to use symlinks because my script allows multiple versions of the Arduino IDE to be installed but I want the user to be able to always refer to a single installation folder, regardless of which IDE version they're currently testing with.

Hello,
Dropping incoming IPv4 traffic seems to solve this issue.

Example

# steps to do before the install
before_install:
  # download the Arduino IDE, use HTTPS
  - wget https://downloads.arduino.cc/arduino-$ARDUINO_VERSION_TO_USE-linux64.tar.xz
  # unpack it
  - tar xf arduino-$ARDUINO_VERSION_TO_USE-linux64.tar.xz
  # move the unpacked items to a better location
  - sudo mv arduino-$ARDUINO_VERSION_TO_USE /usr/local/share/arduino
  # add the arduino directory so executables are also considered/searched for in that arduino-subfolder
  - export PATH=$PATH:/usr/local/share/arduino
  # Arduino IDE adds a lot of noise caused by network traffic, trying to firewall it off
  - sudo iptables -P INPUT DROP
  - sudo iptables -P FORWARD DROP
  - sudo iptables -P OUTPUT ACCEPT
  - sudo iptables -A INPUT -i lo -j ACCEPT
  - sudo iptables -A OUTPUT -o lo -j ACCEPT
- sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT

Great work Torxgewinde! Thanks so much for sharing your solution. I'm going to look into this as soon as I get some free time.

The need to use sudo is a bit of a downer for the purpose of incorporating your solution into my CI script. sudo is currently not needed for my CI script and last I checked you needed to explicitly enable sudo in Travis CI builds (though I recently happened across something in the Travis CI documentation that makes me think there is some change related to this since the last time I needed sudo).

Even if I decide not to incorporate your solution into my script, this is incredibly valuable information for all the people who have suffered from this incredibly annoying output cluttering up their Travis CI build logs.

Thanks! The discussion here and at github was needed to understand what is happening, so also thanks to you.

Torxgewinde:
Hello,
Dropping incoming IPv4 traffic seems to solve this issue.

Nice solution! This solves the problem for me, and my Travis tests are finally able to use a recent Arduino IDE without havig logs full of garbage. Thanks for sharing :slight_smile:

This problem is still alive and well as of now, and I can say that Torxgewinde solved it pretty neatly :slight_smile: Thank you!

Torxgewinde:
Hello,
Dropping incoming IPv4 traffic seems to solve this issue.

Example

# steps to do before the install

before_install:
  # download the Arduino IDE, use HTTPS
  - wget https://downloads.arduino.cc/arduino-$ARDUINO_VERSION_TO_USE-linux64.tar.xz
  # unpack it
  - tar xf arduino-$ARDUINO_VERSION_TO_USE-linux64.tar.xz
  # move the unpacked items to a better location
  - sudo mv arduino-$ARDUINO_VERSION_TO_USE /usr/local/share/arduino
  # add the arduino directory so executables are also considered/searched for in that arduino-subfolder
  - export PATH=$PATH:/usr/local/share/arduino
  # Arduino IDE adds a lot of noise caused by network traffic, trying to firewall it off
  - sudo iptables -P INPUT DROP
  - sudo iptables -P FORWARD DROP
  - sudo iptables -P OUTPUT ACCEPT
  - sudo iptables -A INPUT -i lo -j ACCEPT
  - sudo iptables -A OUTPUT -o lo -j ACCEPT

  • sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT