hoijui / JavaOSC

OSC content format/"protocol" library for JVM languages
http://www.illposed.com/software/javaosc.html
BSD 3-Clause "New" or "Revised" License
156 stars 43 forks source link

Failing unit tests (on some system(s)) #46

Closed hoijui closed 3 years ago

hoijui commented 4 years ago

image

It seems that two of the tests do not pass at the moment.

Originally posted by @cansik in https://github.com/hoijui/JavaOSC/pull/45#issuecomment-548002524

cansik commented 4 years ago

It's on a MacOS Mojave 10.14.6, using Java 11 with openJDK.

openjdk 11.0.2 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)

The two tests always fail, here are the error messages:

readWriteReadData50000

java.io.IOException: Message too long

    at java.base/sun.nio.ch.DatagramDispatcher.write0(Native Method)
    at java.base/sun.nio.ch.DatagramDispatcher.write(DatagramDispatcher.java:51)
    at java.base/sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:113)
    at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:79)
    at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:50)
    at java.base/sun.nio.ch.DatagramChannelImpl.write(DatagramChannelImpl.java:708)
    at com.illposed.osc.transport.udp.OSCPortTest.readWriteReadData(OSCPortTest.java:354)
    at com.illposed.osc.transport.udp.OSCPortTest.readWriteReadData(OSCPortTest.java:320)
    at com.illposed.osc.transport.udp.OSCPortTest.readWriteReadData50000(OSCPortTest.java:280)

It seems that 50k bytes is too much on my MacOS. The senderChannel.socket().getSendBufferSize() of the sender socket is 9216 bytes. But we can increase this by the following code, which fixes the test case. Should we add it to the socket creation too?

senderChannel.socket().setSendBufferSize(OSCPortIn.BUFFER_SIZE);

Could look like this in the OSCPort class (https://github.com/cansik/JavaOSC/commit/1dd37b9ebea58414f228ed46dfa4737054a3e292):

this.channel.setOption(StandardSocketOptions.SO_SNDBUF, OSCPortIn.BUFFER_SIZE);
this.channel.setOption(StandardSocketOptions.SO_REUSEADDR, true);
this.channel.setOption(StandardSocketOptions.SO_BROADCAST, true);

Maybe you also want to set the receive buffer there.

testBundleReceiving

java.lang.AssertionError: Message was not received

    at org.junit.Assert.fail(Assert.java:88)
    at com.illposed.osc.transport.udp.OSCPortTest.testBundleReceiving(OSCPortTest.java:524)

It seems that this is a bug when running all tests together. A solo run of the test seems ok (messages are coming in). It does not work with all the other tasks, even if I increase the wait time. I think that's just something very specific on my machine.

hoijui commented 4 years ago

oebrigens, i chumme urspruenglech us em aargau, wohne jetzt aber scho es wiili en berlin. fallsd do mol en couch bruchsch.. besch wellkomme. ;-) "lets the viewer playfully experience how important collective coexistence is and how easy it is to accomplish a task with it" (aben) fendi super!

I ben metglieg vo Open Source Ecology Germany. und anderne sache wo Ingenieure und kuenstler und sustigi spenner zaeme choemmed, falls dech da interessiert.. wennd mol chunsch.

hoijui commented 4 years ago

I merged your suggestion, and ... at some point, will have a look at the receive buffer. thank you!

cansik commented 4 years ago

Haha super :) Merci vielmal fürd iiladig, da chumi sicher gern mal druf zrugg! Bisch denn jetzt det am schaffe oder wiso hets di usem schöne Aargau nach Berlin zoge ;)?

hoijui commented 4 years ago

:-) I be sozaege gfluechtet us em aargau vo minere muetter. esch zwar det landschaftlech schoener, aber sozial esch es en wuesti (ver mech). i be scho 8 johr en berlin, damols esch mini usred gsi, master studiere, aber ebbe.. grund esch gsi, dassi entdlech wegg ha muesse/choenne. esch ned eifach gsi, aber sehr guet. metlerwiile wuerdi au eher wedder ergendw henne go wos meh natur het. da chunt e de naechste johre ergend einishc. aber zrugg id schwiiz wotti eigneltech nie meh. i kenne do velli coli sache.. met usgang und so hannis ned ma huet, aber sust channi der zueg zeige empfehle (a de uni, bouldere, velo hanni au eis ver gaest, und es get do jo emmer cooli meetings ueber was ver themene au emer eim interessiered).

hoijui commented 4 years ago

should be fixed now with commit https://github.com/hoijui/JavaOSC/commit/1dd37b9ebea58414f228ed46dfa4737054a3e292 being in master.

... or are we still interested in also setting the receive buffer size?