Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

triggers watchdog #127

Closed
folkertvanheusden opened this issue Aug 3, 2021 · 8 comments
Closed

triggers watchdog #127

folkertvanheusden opened this issue Aug 3, 2021 · 8 comments
Labels

Comments

@folkertvanheusden
Copy link

Hi,

I believe it may need a few calls to yield() here and there.
I took the basic ESP8266_NoteOnOffEverySec.ino, added mDNS and as soon as something connects to it, the watchdog gets triggered:

0x40203398: appleMidi::AppleMIDISession ::available() at /home/folkert/Projects/sketches/libraries/AppleMIDI/src/AppleMIDI.hpp line 30
0x402033f6: loop() at /home/folkert/Projects/sketches/libraries/MIDI_Library/src/MIDI.hpp line 712
0x401003ac: ets_post(uint8, ETSSignal, ETSParam) at /home/folkert/.arduino15/packages/esp8266/hardware/esp8266/3.0.1/cores/esp8266/core_esp8266_main.cpp line 181
0x40209ee4: loop_wrapper() at /home/folkert/.arduino15/packages/esp8266/hardware/esp8266/3.0.1/cores/esp8266/core_esp8266_main.cpp line 201

esp8266_test.zip

@folkertvanheusden
Copy link
Author

folkertvanheusden commented Aug 3, 2021

Dug a bit into it and:

In src/AppleMIDI.hpp there's (line 27):

template <class UdpClass, class Settings, class Platform>
void AppleMIDISession<UdpClass, Settings, Platform>::parseControlPackets()
{
    while (controlBuffer.size() > 0)
    {
        auto retVal = _appleMIDIParser.parse(controlBuffer, amPortType::Control);
        if (retVal == parserReturn::UnexpectedData)

But 'parse' can also return parserReturn::NotSureGiveMeMoreData (and others) causing the loop to loop forever which then triggers the wdt.
So I suggest parserReturn::Processed to be checked against there.

It doesn't explain why it fails to communicate with https://github.com/davidmoreno/rtpmidid though.

lathoub added a commit that referenced this issue Aug 21, 2021
@lathoub
Copy link
Owner

lathoub commented Aug 21, 2021

additional test to avoid infinite loop (added in master branch, tested on ESP32)

auto retVal = _appleMIDIParser.parse(controlBuffer, amPortType::Control);
if (retVal == parserReturn::Processed
|| retVal == parserReturn::NotEnoughData
|| retVal == parserReturn::NotSureGiveMeMoreData)
{
break;
}

@folkertvanheusden does this resolve this issue?

@lathoub
Copy link
Owner

lathoub commented Aug 21, 2021

@folkertvanheusden thank you reporting and proactive digging into the issue

@folkertvanheusden
Copy link
Author

folkertvanheusden commented Aug 21, 2021 via email

@lathoub
Copy link
Owner

lathoub commented Aug 21, 2021

The one from the branch I responded last on worked fine. Haven't tested the merged version yet.

That did not have the fix yet :-)

@folkertvanheusden
Copy link
Author

folkertvanheusden commented Aug 21, 2021 via email

@lathoub
Copy link
Owner

lathoub commented Aug 21, 2021

Only 1 branch now: master
Master now contains a fix for the above issue (session names already solved and folded in master earlier today)

@lathoub
Copy link
Owner

lathoub commented Aug 22, 2021

I did another fix: the session name of the data invitation was incorrect: it send back the remote session name, rather than the local name.

Maybe that addresses the below issue:

It doesn't explain why it fails to communicate with https://github.com/davidmoreno/rtpmidid though.

@lathoub lathoub closed this as completed Aug 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants