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

Using network commands in log handler is not recommended #11

Open
nzottmann opened this issue Jul 1, 2020 · 0 comments
Open

Using network commands in log handler is not recommended #11

nzottmann opened this issue Jul 1, 2020 · 0 comments

Comments

@nzottmann
Copy link

This log handler is sending udp packets in the log handler function:

int ret = m_udp.sendPacket(packet, packet.length(), m_address, m_port);

Using network functions in the log handler function is not recommended:

I would recommend not doing anything that takes any time or can block from the log handler. This includes publishing, network, and any shared resource calls like SPI.
https://community.particle.io/t/udp-or-particle-publish-in-log-handler-causing-freeze-with-system-thread/56826/4

Using this log handler in combination with SYSTEM_THREAD(ENABLED) can cause freezes on 3rd gen Devices, as described in the Particle forum thread linked above.

To solve this, the logs could be saved to a buffer and the network functions moved to the main loop, as suggested and implemented by @rickkas7 in https://github.com/rickkas7/SdCardLogHandlerRK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant