j4s0n-c / trowaSoft-VCV

trowaSoft Modules for VCV Rack
Other
104 stars 17 forks source link

Crash in V2 because of badly formed OSC packages #63

Open thomasfredericks opened 1 year ago

thomasfredericks commented 1 year ago

Hi! Thank you for the great module! And thank you for updating it for VCV Rack 2!

I use an Arduino Nano to send OSC messages through USB Serial. The Arduino Nano is a cheap clone. This generates a few errors in the SLIP and OSC packaging. These errors are caused by hardware and are inevitable.

When I use https://github.com/RuudMulder/SlipOscBridge cvOSCcv sometimes crashes. I beleive this is because the OSC messages relayed by SlipOscBridge are sometimes malformed (as I noted in this issue : https://github.com/RuudMulder/SlipOscBridge/issues/2)

Here the tail of the log:

[1182.071 fatal adapters/standalone.cpp:49 fatalSignalHandler] Fatal signal 22. Stack trace:
14:  0x0
13: raise 0x7ffe761fd9c0
12: abort 0x7ffe762020b0
11: ZN9TS_PadBtnD1Ev 0x3a6c27f80
10: Z7sprintfPcPKcz 0x3a6c0ff50
9: ZSt19__throw_regex_errorNSt15regex_constants10error_typeEPKc 0x3a6cda710
8: ZZNSt8__detail9_CompilerINSt7__cxx1112regex_traitsIcEEE18_M_expression_termILb1ELb1EEEbRSt4pairIbcERNS_15_BracketMatcherIS3_XT_EXT0_EEEENKUlcE_clEc 0x3a6ce48d0
7: ZN3osc17OscPacketListener13ProcessPacketEPKciRK14IpEndpointName 0x3a6c23130
6: ZN24SocketReceiveMultiplexer14Implementation3RunEv 0x3a6c1f540
5: ZZNSt8__detail9_CompilerINSt7__cxx1112regex_traitsIcEEE18_M_expression_termILb1ELb1EEEbRSt4pairIbcERNS_15_BracketMatcherIS3_XT_EXT0_EEEENKUlcE_clEc 0x3a6ce48d0
4: pthread_create_wrapper 0x7ffe2d5c4c20
3: beginthreadex 0x7ffe7620de80
2: endthreadex 0x7ffe7620dfe0
1: BaseThreadInitThunk 0x7ffe749b54d0
0: RtlUserThreadStart 0x7ffe76324830

If I instead use Pure Data to relay the OSC Slip messages, Pure Data identifies the badly formed messages and does not relay them to cvOSCcv: 2022-09-26 15_50_55-MicroOsc Slip Tester (Pure Data) pd_  edit  - C__Users_tof_Desktop

While I could just use Pure Data, I think cvOSCcv should not crash if the OSC packet is malformed and just discard it.

chichian commented 1 year ago

Hi Thomas.

Thanks for reporting. We'll look into this when I get time. I think I may have to edit the OSC library for this as I thought I had wrapped message handling on our side in try-catches (or maybe those don't catch the error).

thomasfredericks commented 1 year ago

Hi, if you ever need any bad OSC messages I can cook up a Pure Data patch for testing!

chichian commented 1 year ago

Hi Thomas,

I started looking at this. Could you send a pd patch with bad OSC messages? Thanks!

thomasfredericks commented 1 year ago

Here you go. Good messages do not crash VCV Rack. Bad messages do. cvOSCcv tester.zip

chichian commented 1 year ago

Hi Thomas,

Thanks for the file. I pushed a commit that will fix it. If you can compile from source, then it should be good to go. You can test in your real application to see how it performs.

Otherwise, we will be pushing to library again after we get maybe a few more changes in.

chichian commented 1 year ago

Hi. This has been fixed in the latest release v2.0.6 and should update in the library in the next week or so.

thomasfredericks commented 1 year ago

Hi. Thank you so much! It seems to work great! cvOSCcv opens up VCV Rack so much! I teach my students (in French) how to connect Arduino to VCV Rack thanks to your plugin : https://tim-montmorency.com/rel-electro-immersif/vcv_rack/vcv_rack_osc.html